diff -r 1771360b740d -r ff194559eb41 ucx/mempool.h --- a/ucx/mempool.h Fri Oct 05 11:55:36 2012 +0200 +++ b/ucx/mempool.h Fri Oct 05 13:23:25 2012 +0200 @@ -6,6 +6,7 @@ #define MPOOL_H #include +#include "allocator.h" #ifdef __cplusplus extern "C" { @@ -19,25 +20,10 @@ size_t size; } UcxMempool; -typedef void*(*ucx_allocator_malloc)(UcxMempool *pool, size_t n); -typedef void*(*ucx_allocator_calloc)(UcxMempool *pool, size_t n, size_t size); -typedef void*(*ucx_allocator_realloc)(UcxMempool *pool, void *data, size_t n); - -typedef struct { - UcxMempool *pool; - ucx_allocator_malloc malloc; - ucx_allocator_calloc calloc; - ucx_allocator_realloc realloc; -} UcxAllocator; - -#define UCX_ALLOCATOR_DEFAULT {NULL, \ - ucx_default_malloc, ucx_default_calloc, ucx_default_realloc} #define UCX_ALLOCATOR_MEMPOOL(pool) {pool, \ - ucx_mempool_malloc, ucx_mempool_calloc, ucx_mempool_realloc} - -void *ucx_default_malloc(UcxMempool *ignore, size_t n); -void *ucx_default_calloc(UcxMempool *ignore, size_t n, size_t size); -void *ucx_default_realloc(UcxMempool *ignore, void *data, size_t n); + (ucx_allocator_malloc) ucx_mempool_malloc, \ + (ucx_allocator_calloc) ucx_mempool_calloc, \ + (ucx_allocator_realloc) ucx_mempool_realloc} #define ucx_mempool_new_default() ucx_mempool_new(16) UcxMempool *ucx_mempool_new(size_t n);