diff -r 3dc9075df822 -r eb9e7bd40a8e src/allocator.c --- a/src/allocator.c Sat Jan 29 14:32:04 2022 +0100 +++ b/src/allocator.c Sun Jan 30 14:19:00 2022 +0100 @@ -61,19 +61,30 @@ &cx_default_allocator_class, NULL }; -CxAllocator cxDefaultAllocator = &cx_default_allocator; +CxAllocator *cxDefaultAllocator = &cx_default_allocator; /* IMPLEMENTATION OF HIGH LEVEL API */ -void *cxMalloc(CxAllocator allocator, size_t n) { +void *cxMalloc( + CxAllocator *allocator, + size_t n +) { return allocator->cl->malloc(allocator->data, n); } -void *cxRealloc(CxAllocator allocator, void *mem, size_t n) { +void *cxRealloc( + CxAllocator *allocator, + void *mem, + size_t n +) { return allocator->cl->realloc(allocator->data, mem, n); } -int cxReallocate(CxAllocator allocator, void **mem, size_t n) { +int cxReallocate( + CxAllocator *allocator, + void **mem, + size_t n +) { void *nmem = allocator->cl->realloc(allocator->data, *mem, n); if (nmem == NULL) { return 1; @@ -83,10 +94,17 @@ } } -void *cxCalloc(CxAllocator allocator, size_t nelem, size_t n) { +void *cxCalloc( + CxAllocator *allocator, + size_t nelem, + size_t n +) { return allocator->cl->calloc(allocator->data, nelem, n); } -void cxFree(CxAllocator allocator, void *mem) { +void cxFree( + CxAllocator *allocator, + void *mem +) { allocator->cl->free(allocator->data, mem); }