mailing list of musl libc
 help / color / mirror / code / Atom feed
8cccd9d8d68b2e4fc6a230a7e9f0537a60c2353a blob 376 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 
#include <malloc.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 CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD;
}
debug log:

solving 8cccd9d ...
found 8cccd9d in https://git.vuxu.org/mirror/musl/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).