diff options
author | quou <quou@disroot.org> | 2024-06-02 21:46:07 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-06-02 21:47:26 +1000 |
commit | 62b4a3ededd237f4b4850d91c052585e2f687499 (patch) | |
tree | 25bf590a634c6c71f399cf9b1d620500f06b8b9f /memory.c | |
parent | 2e761bdb8badecdbda2925a056a6d5aa3e3cac83 (diff) |
Switched to luigi, parsing out FLAC metadata.
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -75,7 +75,6 @@ static void* heap_alloc_impla(Heap* h, int size) { as = size + sizeof *header; p = 0; m = sizeof *header; - h->usage += as; for (i = 0; i < h->blocks; i++) { header = (int*)(h->buffer + p); s = header[0]; @@ -87,9 +86,11 @@ static void* heap_alloc_impla(Heap* h, int size) { header[0] = (s << 1); nh = (int*)(h->buffer + p + s); nh[0] = (as << 1) | 1; + h->usage += as; h->blocks++; return nh + 1; } else if (s == as) { + h->usage += as; header[0] |= 1; return header + 1; } @@ -203,6 +204,11 @@ void heap_free(Heap* h, void* ptr) { heap_free_aligned(h, ptr); } +int heap_block_size(void* ptr) { + int h = ((int*)ptr)[-1]; + return h >> 1; +} + void* galloc(int size) { #if use_system_malloc return malloc(size); |