ucx/allocator.h

Fri, 12 Oct 2012 10:54:55 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 12 Oct 2012 10:54:55 +0200
changeset 69
fb59270b1de3
parent 52
34f50d0bada4
child 103
08018864fb91
permissions
-rw-r--r--

made the code work with VC++ compiler (use make CONF=windows)

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