Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: fusl/src/malloc/malloc_usable_size.c

Issue 1689833004: [fusl] Update fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove stray space Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/legacy/utmpx.c ('k') | fusl/src/network/lookup.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <malloc.h> 1 #include <malloc.h>
2 2
3 void *(*const __realloc_dep)(void *, size_t) = realloc; 3 void *(*const __realloc_dep)(void *, size_t) = realloc;
4 4
5 struct chunk { 5 struct chunk {
6 size_t psize, csize; 6 size_t psize, csize;
7 struct chunk *next, *prev; 7 struct chunk *next, *prev;
8 }; 8 };
9 9
10 #define OVERHEAD (2*sizeof(size_t)) 10 #define OVERHEAD (2*sizeof(size_t))
11 #define CHUNK_SIZE(c) ((c)->csize & -2) 11 #define CHUNK_SIZE(c) ((c)->csize & -2)
12 #define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD) 12 #define MEM_TO_CHUNK(p) (struct chunk *)((char *)(p) - OVERHEAD)
13 13
14 size_t malloc_usable_size(void *p) 14 size_t malloc_usable_size(void *p)
15 { 15 {
16 » return CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD; 16 » return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0;
17 } 17 }
OLDNEW
« no previous file with comments | « fusl/src/legacy/utmpx.c ('k') | fusl/src/network/lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698