ucx/allocator.h

Fri, 05 Oct 2012 13:23:25 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 05 Oct 2012 13:23:25 +0200
changeset 50
ff194559eb41
child 52
34f50d0bada4
permissions
-rw-r--r--

moved allocator to seperate file

function signatures are now "generic" and not restricted to UcxMempool

universe@50 1 #ifndef ALLOCATOR_H
universe@50 2 #define ALLOCATOR_H
universe@50 3
universe@50 4 #include <stddef.h>
universe@50 5
universe@50 6 #ifdef __cplusplus
universe@50 7 extern "C" {
universe@50 8 #endif
universe@50 9
universe@50 10 typedef void*(*ucx_allocator_malloc)(void *pool, size_t n);
universe@50 11 typedef void*(*ucx_allocator_calloc)(void *pool, size_t n, size_t size);
universe@50 12 typedef void*(*ucx_allocator_realloc)(void *pool, void *data, size_t n);
universe@50 13
universe@50 14 typedef struct {
universe@50 15 void *pool;
universe@50 16 ucx_allocator_malloc malloc;
universe@50 17 ucx_allocator_calloc calloc;
universe@50 18 ucx_allocator_realloc realloc;
universe@50 19 } UcxAllocator;
universe@50 20
universe@50 21 void *ucx_default_malloc(void *ignore, size_t n);
universe@50 22 void *ucx_default_calloc(void *ignore, size_t n, size_t size);
universe@50 23 void *ucx_default_realloc(void *ignore, void *data, size_t n);
universe@50 24
universe@50 25 #define UCX_ALLOCATOR_DEFAULT {NULL, \
universe@50 26 ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
universe@50 27
universe@50 28 #ifdef __cplusplus
universe@50 29 }
universe@50 30 #endif
universe@50 31
universe@50 32 #endif /* ALLOCATOR_H */

mercurial