source: asp3_tinet_ecnl_arm/trunk/musl-1.1.18/src/malloc/malloc_usable_size.c@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 384 bytes
Line 
1#include <malloc.h>
2
3void *(*const __realloc_dep)(void *, size_t) = realloc;
4
5struct chunk {
6 size_t psize, csize;
7 struct chunk *next, *prev;
8};
9
10#define OVERHEAD (2*sizeof(size_t))
11#define CHUNK_SIZE(c) ((c)->csize & -2)
12#define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD)
13
14size_t malloc_usable_size(void *p)
15{
16 return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0;
17}
Note: See TracBrowser for help on using the repository browser.