Fri, 05 Oct 2012 13:23:25 +0200
moved allocator to seperate file
function signatures are now "generic" and not restricted to UcxMempool
1 #ifndef ALLOCATOR_H
2 #define ALLOCATOR_H
4 #include <stddef.h>
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 typedef void*(*ucx_allocator_malloc)(void *pool, size_t n);
11 typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size);
12 typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n);
14 typedef struct {
15 void *pool;
16 ucx_allocator_malloc malloc;
17 ucx_allocator_calloc calloc;
18 ucx_allocator_realloc realloc;
19 } UcxAllocator;
21 void *ucx_default_malloc(void *ignore, size_t n);
22 void *ucx_default_calloc(void *ignore, size_t n, size_t size);
23 void *ucx_default_realloc(void *ignore, void *data, size_t n);
25 #define UCX_ALLOCATOR_DEFAULT {NULL, \
26 ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
28 #ifdef __cplusplus
29 }
30 #endif
32 #endif /* ALLOCATOR_H */