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