6 #include "malloc_impl.h"
10 static void *__simple_malloc(size_t n)
12 static char *cur, *end;
13 static volatile int lock[1];
18 while (align<n && align<ALIGN)
23 pad = -(uintptr_t)cur & align-1;
25 if (n <= SIZE_MAX/2 + ALIGN) n += pad;
29 char *new = __expand_heap(&m);
48 weak_alias(__simple_malloc, malloc);
50 static void *__simple_calloc(size_t m, size_t n)
52 if (n && m > (size_t)-1/n) {
56 return __simple_malloc(n * m);
59 weak_alias(__simple_calloc, calloc);