diff --git a/source/util/src/mallocator.c b/source/util/src/mallocator.c index 0bd8f0742a5b5a2e6450137c93cb73e79c91c37d..1819396ccd5525bb30cef44b977419c3443be906 100644 --- a/source/util/src/mallocator.c +++ b/source/util/src/mallocator.c @@ -104,77 +104,4 @@ static size_t haUsage(SMemAllocator *pma) { return ((SHeapAllocator *)(pma->impl /* ------------------------ ARENA ALLOCATOR ------------------------ */ typedef struct { size_t usage; -} SArenaAllocator; - -#if 0 -SMemAllocator *pDefaultMA; - -typedef struct { - char name[64]; -} SHeapAllocator; - -static SHeapAllocator *haNew(); -static void haDestroy(SHeapAllocator *pha); -static void * haMalloc(SMemAllocator *pMemAllocator, size_t size); -void * haCalloc(SMemAllocator *pMemAllocator, size_t nmemb, size_t size); -static void haFree(SMemAllocator *pMemAllocator, void *ptr); - -SMemAllocator *tdCreateHeapAllocator() { - SMemAllocator *pMemAllocator = NULL; - - pMemAllocator = (SMemAllocator *)calloc(1, sizeof(*pMemAllocator)); - if (pMemAllocator == NULL) { - // TODO: handle error - return NULL; - } - - pMemAllocator->impl = haNew(); - if (pMemAllocator->impl == NULL) { - tdDestroyHeapAllocator(pMemAllocator); - return NULL; - } - - pMemAllocator->malloc = haMalloc; - pMemAllocator->calloc = haCalloc; - pMemAllocator->realloc = NULL; - pMemAllocator->free = haFree; - pMemAllocator->usage = NULL; - - return pMemAllocator; -} - -void tdDestroyHeapAllocator(SMemAllocator *pMemAllocator) { - if (pMemAllocator) { - // TODO - } -} - -/* ------------------------ STATIC METHODS ------------------------ */ -static SHeapAllocator *haNew() { - SHeapAllocator *pha = NULL; - /* TODO */ - return pha; -} - -static void haDestroy(SHeapAllocator *pha) { - // TODO -} - -static void *haMalloc(SMemAllocator *pMemAllocator, size_t size) { - void *ptr = NULL; - - ptr = malloc(size); - if (ptr) { - } - - return ptr; -} - -void *haCalloc(SMemAllocator *pMemAllocator, size_t nmemb, size_t size) { - /* TODO */ - return NULL; -} - -static void haFree(SMemAllocator *pMemAllocator, void *ptr) { /* TODO */ -} -#endif \ No newline at end of file +} SArenaAllocator; \ No newline at end of file