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

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

Issue 1706293003: [fusl] Remove some more tabs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: apptest rebase 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/crypt/crypt_des.c ('k') | fusl/src/math/exp2l.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #define _GNU_SOURCE 1 #define _GNU_SOURCE
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <string.h> 3 #include <string.h>
4 #include <limits.h> 4 #include <limits.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include "libc.h" 8 #include "libc.h"
9 #include "atomic.h" 9 #include "atomic.h"
10 #include "pthread_impl.h" 10 #include "pthread_impl.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return (((union { 126 return (((union {
127 float v; 127 float v;
128 uint32_t r; 128 uint32_t r;
129 }){(int)x} 129 }){(int)x}
130 .r + 130 .r +
131 0x1fffff) >> 131 0x1fffff) >>
132 21) - 132 21) -
133 496; 133 496;
134 } 134 }
135 135
136 #if 0
137 void __dump_heap(int x)
138 {
139 struct chunk *c;
140 int i;
141 for (c = (void *)mal.heap; CHUNK_SIZE(c); c = NEXT_CHUNK(c))
142 fprintf(stderr, "base %p size %zu (%d) flags %d/%d\n",
143 c, CHUNK_SIZE(c), bin_index(CHUNK_SIZE(c)),
144 c->csize & 15,
145 NEXT_CHUNK(c)->psize & 15);
146 for (i=0; i<64; i++) {
147 if (mal.bins[i].head != BIN_TO_CHUNK(i) && mal.bins[i].head) {
148 fprintf(stderr, "bin %d: %p\n", i, mal.bins[i].head);
149 if (!(mal.binmap & 1ULL<<i))
150 fprintf(stderr, "missing from binmap!\n");
151 } else if (mal.binmap & 1ULL<<i)
152 fprintf(stderr, "binmap wrongly contains %d!\n", i);
153 }
154 }
155 #endif
156
157 void* __expand_heap(size_t*); 136 void* __expand_heap(size_t*);
158 137
159 static struct chunk* expand_heap(size_t n) { 138 static struct chunk* expand_heap(size_t n) {
160 static int heap_lock[2]; 139 static int heap_lock[2];
161 static void* end; 140 static void* end;
162 void* p; 141 void* p;
163 struct chunk* w; 142 struct chunk* w;
164 143
165 /* The argument n already accounts for the caller's chunk 144 /* The argument n already accounts for the caller's chunk
166 * overhead needs, but if the heap can't be extended in-place, 145 * overhead needs, but if the heap can't be extended in-place,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 #if 1 505 #if 1
527 __madvise((void*)a, b - a, MADV_DONTNEED); 506 __madvise((void*)a, b - a, MADV_DONTNEED);
528 #else 507 #else
529 __mmap((void*)a, b - a, PROT_READ | PROT_WRITE, 508 __mmap((void*)a, b - a, PROT_READ | PROT_WRITE,
530 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); 509 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
531 #endif 510 #endif
532 } 511 }
533 512
534 unlock_bin(i); 513 unlock_bin(i);
535 } 514 }
OLDNEW
« no previous file with comments | « fusl/src/crypt/crypt_des.c ('k') | fusl/src/math/exp2l.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698