ucx/mempool.c

changeset 48
621a4430c404
parent 28
1666cbeb1db8
child 50
ff194559eb41
equal deleted inserted replaced
46:48ca036d7d9c 48:621a4430c404
20 } ucx_regdestr; 20 } ucx_regdestr;
21 21
22 void ucx_mempool_shared_destr(void* ptr) { 22 void ucx_mempool_shared_destr(void* ptr) {
23 ucx_regdestr *rd = (ucx_regdestr*)ptr; 23 ucx_regdestr *rd = (ucx_regdestr*)ptr;
24 rd->destructor(rd->ptr); 24 rd->destructor(rd->ptr);
25 }
26
27 void *ucx_default_malloc(UcxMempool *ignore, size_t n) {
28 return malloc(n);
29 }
30 void *ucx_default_calloc(UcxMempool *ignore, size_t n, size_t size) {
31 return calloc(n, size);
32 }
33 void *ucx_default_realloc(UcxMempool *ignore, void *data, size_t n) {
34 return realloc(data, n);
25 } 35 }
26 36
27 UcxMempool *ucx_mempool_new(size_t n) { 37 UcxMempool *ucx_mempool_new(size_t n) {
28 UcxMempool *pool = (UcxMempool*)malloc(sizeof(UcxMempool)); 38 UcxMempool *pool = (UcxMempool*)malloc(sizeof(UcxMempool));
29 if (pool == NULL) return NULL; 39 if (pool == NULL) return NULL;

mercurial