Initial import
This commit is contained in:
10
third_party/dlmalloc/dlmalloc-usable.c
vendored
Normal file
10
third_party/dlmalloc/dlmalloc-usable.c
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#include "libc/mem/mem.h"
|
||||
#include "third_party/dlmalloc/dlmalloc.h"
|
||||
|
||||
size_t dlmalloc_usable_size(const void* mem) {
|
||||
if (mem != 0) {
|
||||
mchunkptr p = mem2chunk(mem);
|
||||
if (is_inuse(p)) return chunksize(p) - overhead_for(p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user