ucx/mempool.c

changeset 50
ff194559eb41
parent 48
621a4430c404
child 57
e18157c52985
equal deleted inserted replaced
49:1771360b740d 50:ff194559eb41
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);
35 } 25 }
36 26
37 UcxMempool *ucx_mempool_new(size_t n) { 27 UcxMempool *ucx_mempool_new(size_t n) {
38 UcxMempool *pool = (UcxMempool*)malloc(sizeof(UcxMempool)); 28 UcxMempool *pool = (UcxMempool*)malloc(sizeof(UcxMempool));
39 if (pool == NULL) return NULL; 29 if (pool == NULL) return NULL;

mercurial