From: Rich Felker Date: Tue, 11 Sep 2018 19:07:16 +0000 (-0400) Subject: rework malloc_usable_size to use malloc_impl.h X-Git-Tag: v1.1.21~110 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ef8d45d6c9036b23087461550e95683804ed0084;p=oweals%2Fmusl.git rework malloc_usable_size to use malloc_impl.h --- 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 +#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;