posix_memalign in calloc

This commit is contained in:
Andrea Fioraldi 2021-03-11 10:11:22 +01:00
parent 3752821ab4
commit 93d484bb58

View File

@ -156,9 +156,10 @@ void *calloc(size_t nmemb, size_t size) {
k &= MAP_SIZE - 1; k &= MAP_SIZE - 1;
__lafl_alloc_map[k] = MAX(__lafl_alloc_map[k], size); __lafl_alloc_map[k] = MAX(__lafl_alloc_map[k], size);
void *result = realloc(NULL, size); void *ret = NULL;
memset(result, 0, size); posix_memalign(&ret, 1<<6, size);
return result; memset(ret, 0, size);
return ret;
} }