Fri, 05 Oct 2012 16:59:14 +0200
added ucx_map_copy and fixed ucx_map_rehash
olaf@52 | 1 | #ifndef ALLOCATOR_H |
olaf@52 | 2 | #define ALLOCATOR_H |
olaf@52 | 3 | |
olaf@52 | 4 | #ifdef __cplusplus |
olaf@52 | 5 | extern "C" { |
olaf@52 | 6 | #endif |
olaf@52 | 7 | |
olaf@52 | 8 | typedef void*(*ucx_allocator_malloc)(void *pool, size_t n); |
olaf@52 | 9 | typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size); |
olaf@52 | 10 | typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n); |
olaf@52 | 11 | |
olaf@52 | 12 | typedef struct { |
olaf@52 | 13 | void *pool; |
olaf@52 | 14 | ucx_allocator_malloc malloc; |
olaf@52 | 15 | ucx_allocator_calloc calloc; |
olaf@52 | 16 | ucx_allocator_realloc realloc; |
olaf@52 | 17 | } UcxAllocator; |
olaf@52 | 18 | |
olaf@52 | 19 | void *ucx_default_malloc(void *ignore, size_t n); |
olaf@52 | 20 | void *ucx_default_calloc(void *ignore, size_t n, size_t size); |
olaf@52 | 21 | void *ucx_default_realloc(void *ignore, void *data, size_t n); |
olaf@52 | 22 | |
olaf@52 | 23 | #define UCX_ALLOCATOR_DEFAULT {NULL, \ |
olaf@52 | 24 | ucx_default_malloc, ucx_default_calloc, ucx_default_realloc} |
olaf@52 | 25 | |
olaf@52 | 26 | #ifdef __cplusplus |
olaf@52 | 27 | } |
olaf@52 | 28 | #endif |
olaf@52 | 29 | |
olaf@52 | 30 | #endif /* ALLOCATOR_H */ |
olaf@52 | 31 |