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

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

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too 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
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 return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0;
16 » return p ? CHUNK_SIZE(MEM_TO_CHUNK(p)) - OVERHEAD : 0;
17 } 16 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698