diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-16 18:07:24 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-16 18:07:24 +0200 |
commit | bb2dd23f315bafa7b0b64845c2fe25d7a0893b10 (patch) | |
tree | 51657cd1ad8b6f1d5941604e75c251a246809034 /src/lib/libc/malloc.c | |
parent | 3d6a857b9186ef6304ea6cf04627c2b787169f29 (diff) | |
download | kogata-bb2dd23f315bafa7b0b64845c2fe25d7a0893b10.tar.gz kogata-bb2dd23f315bafa7b0b64845c2fe25d7a0893b10.zip |
Got Lua running \o/
Diffstat (limited to 'src/lib/libc/malloc.c')
-rw-r--r-- | src/lib/libc/malloc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/libc/malloc.c b/src/lib/libc/malloc.c index 473404b..fd37f76 100644 --- a/src/lib/libc/malloc.c +++ b/src/lib/libc/malloc.c @@ -54,7 +54,10 @@ void malloc_setup() { void* malloc(size_t size) { if (size == 0) return 0; - return slab_alloc(mem_allocator, size); + //dbg_printf("malloc 0x%p -> ", size); + void* ret = slab_alloc(mem_allocator, size); + //dbg_printf("0x%p\n", ret); + return ret; } void* calloc(size_t nmemb, size_t sz) { @@ -64,10 +67,16 @@ void* calloc(size_t nmemb, size_t sz) { } void* realloc(void* ptr, size_t sz) { - return slab_realloc(mem_allocator, ptr, sz); + //dbg_printf("realloc 0x%p 0x%p -> ", ptr, sz); + void* ret = slab_realloc(mem_allocator, ptr, sz); + //dbg_printf("0x%p\n", ret); + return ret; } void free(void* ptr) { + if (ptr == 0) return; + + //dbg_printf("free 0x%p\n", ptr); slab_free(mem_allocator, ptr); } |