ucx/allocator.h

Wed, 06 Feb 2013 12:55:56 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 06 Feb 2013 12:55:56 +0100
changeset 78
af355652f271
parent 69
fb59270b1de3
child 103
08018864fb91
permissions
-rw-r--r--

some fixes

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

mercurial