diff options
author | Christian C <cc@localhost> | 2025-04-02 18:19:43 -0700 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-04-02 18:19:43 -0700 |
commit | f5c4c049bf8b6b246445a7e27361a16195c0b4ab (patch) | |
tree | 510ea47c2979dfb97892559ade69b56d611cefd6 /lib/mem/galloc.c | |
parent | 00ce37145556279f4982ef52a747cb2f5e3e3081 (diff) |
Remove temporary allocatordev
Diffstat (limited to 'lib/mem/galloc.c')
-rw-r--r-- | lib/mem/galloc.c | 46 |
1 files changed, 0 insertions, 46 deletions
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 <lib/mem/galloc.h> -#include <stdlib.h> -#include <stdio.h> - -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; } |