source: tests/zombies/gc_no_raii/src/allocate-pool.c @ 996c8ed

ADTast-experimental
Last change on this file since 996c8ed was 87b9332, checked in by Andrew Beach <ajbeach@…>, 4 years ago

Moved 'examples/' to 'tests/zombies/'.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#define _BSD_SOURCE /* for MAP_ANON */
2#define _DARWIN_C_SOURCE /* for MAP_ANON on OS X */
3
4#ifdef __cforall
5extern "C"{
6#else
7#error missing cfa define
8#endif
9
10/* for standards info */
11#if defined(unix) || defined(__unix) || defined(__unix__) || \
12    (defined(__APPLE__) && defined(__MACH__))
13#include <unistd.h>
14#endif
15
16#if defined(_WIN32)
17#ifndef WIN32_LEAN_AND_MEAN
18#define WIN32_LEAN_AND_MEAN
19#endif
20#include <windows.h>
21#endif
22
23#include <errno.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27#include <sys/types.h>
28
29#if _POSIX_VERSION
30#include <sys/mman.h>
31#endif
32
33/* figure out which allocator to use */
34#if defined(GGGGC_USE_MALLOC)
35#define GGGGC_ALLOCATOR_MALLOC 1
36#include "../pool-alloc/allocate-malloc.c"
37
38#elif _POSIX_ADVISORY_INFO >= 200112L
39#define GGGGC_ALLOCATOR_POSIX_MEMALIGN 1
40#include "../pool-alloc/allocate-malign.c"
41
42#elif defined(MAP_ANON)
43#define GGGGC_ALLOCATOR_MMAP 1
44#include "../pool-alloc/allocate-mmap.c"
45
46#elif defined(_WIN32)
47#define GGGGC_ALLOCATOR_VIRTUALALLOC 1
48#include "../pool-alloc/allocate-win-valloc.c"
49
50#else
51#warning GGGGC: No allocator available other than malloc!
52#define GGGGC_ALLOCATOR_MALLOC 1
53#include "../pool-alloc/allocate-malloc.c"
54
55#endif
56
57void* pal_allocPool(size_t size, int mustSucceed)
58{
59      return allocPool(size, mustSucceed);
60}
61
62#ifdef __cforall
63}
64#endif
Note: See TracBrowser for help on using the repository browser.