projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
055dfbb
)
rework malloc_usable_size to use malloc_impl.h
author
Rich Felker
<dalias@aerifal.cx>
Tue, 11 Sep 2018 19:07:16 +0000
(15:07 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 12 Sep 2018 18:34:36 +0000
(14:34 -0400)
src/malloc/malloc_usable_size.c
patch
|
blob
|
history
diff --git
a/src/malloc/malloc_usable_size.c
b/src/malloc/malloc_usable_size.c
index 6743ea7752a0c44305b009c80ad7b23d153a5ac0..7a8ed6c401e632fc516757402d4dd417f030d15e 100644
(file)
--- 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;