diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-09-11 15:07:16 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-09-12 14:34:36 -0400 |
commit | ef8d45d6c9036b23087461550e95683804ed0084 (patch) | |
tree | 771caa0266370ad05bc1944abaf4345018bc8a98 /src | |
parent | 055dfbb7f71a67151898a8c4bf82ba930ba35a11 (diff) | |
download | musl-ef8d45d6c9036b23087461550e95683804ed0084.tar.gz musl-ef8d45d6c9036b23087461550e95683804ed0084.tar.bz2 musl-ef8d45d6c9036b23087461550e95683804ed0084.tar.xz musl-ef8d45d6c9036b23087461550e95683804ed0084.zip |
rework malloc_usable_size to use malloc_impl.h
Diffstat (limited to 'src')
-rw-r--r-- | src/malloc/malloc_usable_size.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/malloc/malloc_usable_size.c b/src/malloc/malloc_usable_size.c index 6743ea77..7a8ed6c4 100644 --- a/src/malloc/malloc_usable_size.c +++ b/src/malloc/malloc_usable_size.c @@ -1,16 +1,8 @@ #include <malloc.h> +#include "malloc_impl.h" void *(*const __realloc_dep)(void *, size_t) = realloc; -struct chunk { - size_t psize, csize; - struct chunk *next, *prev; -}; - -#define OVERHEAD (2*sizeof(size_t)) -#define CHUNK_SIZE(c) ((c)->csize & -2) -#define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD) - size_t malloc_usable_size(void *p) { return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0; |