ucx/mempool.h

changeset 50
ff194559eb41
parent 48
621a4430c404
child 69
fb59270b1de3
     1.1 --- a/ucx/mempool.h	Fri Oct 05 11:55:36 2012 +0200
     1.2 +++ b/ucx/mempool.h	Fri Oct 05 13:23:25 2012 +0200
     1.3 @@ -6,6 +6,7 @@
     1.4  #define	MPOOL_H
     1.5  
     1.6  #include <stddef.h>
     1.7 +#include "allocator.h"
     1.8  
     1.9  #ifdef	__cplusplus
    1.10  extern "C" {
    1.11 @@ -19,25 +20,10 @@
    1.12      size_t size;
    1.13  } UcxMempool;
    1.14  
    1.15 -typedef void*(*ucx_allocator_malloc)(UcxMempool *pool, size_t n);
    1.16 -typedef void*(*ucx_allocator_calloc)(UcxMempool *pool, size_t n, size_t size);
    1.17 -typedef void*(*ucx_allocator_realloc)(UcxMempool *pool, void *data, size_t n);
    1.18 -
    1.19 -typedef struct {
    1.20 -    UcxMempool *pool;
    1.21 -    ucx_allocator_malloc malloc;
    1.22 -    ucx_allocator_calloc calloc;
    1.23 -    ucx_allocator_realloc realloc;
    1.24 -} UcxAllocator;
    1.25 -
    1.26 -#define UCX_ALLOCATOR_DEFAULT {NULL, \
    1.27 -    ucx_default_malloc, ucx_default_calloc, ucx_default_realloc}
    1.28  #define UCX_ALLOCATOR_MEMPOOL(pool) {pool, \
    1.29 -    ucx_mempool_malloc, ucx_mempool_calloc, ucx_mempool_realloc}
    1.30 -
    1.31 -void *ucx_default_malloc(UcxMempool *ignore, size_t n);
    1.32 -void *ucx_default_calloc(UcxMempool *ignore, size_t n, size_t size);
    1.33 -void *ucx_default_realloc(UcxMempool *ignore, void *data, size_t n);
    1.34 +    (ucx_allocator_malloc) ucx_mempool_malloc, \
    1.35 +    (ucx_allocator_calloc) ucx_mempool_calloc, \
    1.36 +    (ucx_allocator_realloc) ucx_mempool_realloc}
    1.37  
    1.38  #define ucx_mempool_new_default() ucx_mempool_new(16)
    1.39  UcxMempool *ucx_mempool_new(size_t n);

mercurial