7 uintptr_t __brk(uintptr_t);
11 void *__simple_malloc(size_t n)
13 static uintptr_t cur, brk;
19 if (n > SIZE_MAX/2) goto toobig;
21 while (align<n && align<ALIGN)
23 n = n + align - 1 & -align;
26 if (!cur) cur = brk = __brk(0)+16;
27 base = cur + align-1 & -align;
28 if (n > SIZE_MAX - PAGE_SIZE - base) goto fail;
30 new = base+n + PAGE_SIZE-1 & -PAGE_SIZE;
31 if (__brk(new) != new) goto fail;
46 weak_alias(__simple_malloc, malloc);