From f5c4c049bf8b6b246445a7e27361a16195c0b4ab Mon Sep 17 00:00:00 2001 From: Christian C Date: Wed, 2 Apr 2025 18:19:43 -0700 Subject: Remove temporary allocator --- lib/mem/galloc.c | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 lib/mem/galloc.c (limited to 'lib/mem') diff --git a/lib/mem/galloc.c b/lib/mem/galloc.c deleted file mode 100644 index ea4ea16..0000000 --- a/lib/mem/galloc.c +++ /dev/null @@ -1,46 +0,0 @@ - #include -#include -#include - -static ssize_t standing_allocations = 0; - -void *_g_malloc(size_t size, char* file, unsigned int line) { - void *ptr = malloc(size); - if (ptr == NULL) { - return ptr; - } - fprintf(stderr, "+%p :a: %s:%d\n", ptr, file, line); - standing_allocations++; - return ptr; -} - -void *_g_calloc(size_t n_memb, size_t size, char* file, unsigned int line) { - void *ptr = calloc(n_memb, size); - if (ptr == NULL) { - return ptr; - } - fprintf(stderr, "+%p :c: %s:%d\n", ptr, file, line); - standing_allocations++; - return ptr; -} - -void *_g_realloc(void *ptr, size_t size, char* file, unsigned int line) { - fprintf(stderr, "-%p :r: %s:%d\n", ptr, file, line); - void* temp = realloc(ptr, size); - if (temp == NULL) { - fprintf(stderr, "+%p :r: %s:%d\n", ptr, file, line); - } else { - fprintf(stderr, "+%p :r: %s:%d\n", temp, file, line); - } - return temp; -} - -void _g_free(void *ptr, char* file, unsigned int line) { - if (ptr != NULL) { - fprintf(stderr, "-%p :f: %s:%d\n", ptr, file, line); - free(ptr); - standing_allocations--; - } -} - -ssize_t g_outstanding_allocations() { return standing_allocations; } -- cgit v1.2.1