65 |
66 |
66 void *cxRealloc(CxAllocator allocator, void *mem, size_t n) { |
67 void *cxRealloc(CxAllocator allocator, void *mem, size_t n) { |
67 return allocator->cl->realloc(allocator->data, mem, n); |
68 return allocator->cl->realloc(allocator->data, mem, n); |
68 } |
69 } |
69 |
70 |
|
71 int cxReallocate(CxAllocator allocator, void **mem, size_t n) { |
|
72 if (mem == NULL) { |
|
73 errno = EINVAL; |
|
74 return 1; |
|
75 } |
|
76 void* nmem = allocator->cl->realloc(allocator->data, *mem, n); |
|
77 if (nmem == NULL) { |
|
78 return 1; |
|
79 } else { |
|
80 *mem = nmem; |
|
81 return 0; |
|
82 } |
|
83 } |
|
84 |
70 void *cxCalloc(CxAllocator allocator, size_t nelem, size_t n) { |
85 void *cxCalloc(CxAllocator allocator, size_t nelem, size_t n) { |
71 return allocator->cl->calloc(allocator->data, nelem, n); |
86 return allocator->cl->calloc(allocator->data, nelem, n); |
72 } |
87 } |
73 |
88 |
74 void cxFree(CxAllocator allocator, void *mem) { |
89 void cxFree(CxAllocator allocator, void *mem) { |