]> pd.if.org Git - pdclib/blob - platform/win32/functions/_PDCLIB/_PDCLIB_allocpages.c
Initial pass at a port to win32
[pdclib] / platform / win32 / functions / _PDCLIB / _PDCLIB_allocpages.c
1 /* $Id$ */
2
3 /* _PDCLIB_allocpages( int const )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 /* This is a stub implementation of _PDCLIB_allocpages
10 */
11
12 #ifndef REGTEST
13 #include <stdint.h>
14 #include <stddef.h>
15 #include <_PDCLIB_glue.h>
16 #include <errno.h>
17 #include <windows.h>
18
19 void _PDCLIB_w32errno(void);
20
21 void * _PDCLIB_allocpages( size_t n )
22 {
23     void * rv = VirtualAlloc(NULL, n * _PDCLIB_MALLOC_PAGESIZE, MEM_COMMIT,
24         PAGE_READWRITE);
25     if(!rv) {
26         _PDCLIB_w32errno();
27     }
28     return rv;
29 }
30 #endif
31
32 #ifdef TEST
33 #include <_PDCLIB_test.h>
34
35 int main( void )
36 {
37     return TEST_RESULTS;
38 }
39
40 #endif