static char junkareas[MAX_JUNK_AREAS][JUNK_SIZE];
/* This version use mmalloc if there is a current heap, or the legacy implem if not */
static char junkareas[MAX_JUNK_AREAS][JUNK_SIZE];
/* This version use mmalloc if there is a current heap, or the legacy implem if not */
size_t needed_areas = n / JUNK_SIZE;
if(needed_areas * JUNK_SIZE != n) needed_areas++;
if (allocated_junk+needed_areas>=MAX_JUNK_AREAS) {
size_t needed_areas = n / JUNK_SIZE;
if(needed_areas * JUNK_SIZE != n) needed_areas++;
if (allocated_junk+needed_areas>=MAX_JUNK_AREAS) {
- void *ret = malloc(nmemb*size);
- memset(ret, 0, nmemb * size);
- return ret;
+ return malloc_or_calloc(nmemb*size, 1);