void *malloc(size_t size) { void* ret = allocator_malloc(allocator_get_global(), size); if (!ret) { errno = ENOMEM; } return ret; }
void *realloc(void *ptr, size_t size) { void* ret = allocator_realloc(allocator_get_global(), ptr, size); if (!ret) { errno = ENOMEM; } return ret; }
int posix_memalign(void **memptr, size_t alignment, size_t size) { if ((1 << log2_int(alignment)) != alignment) { return EINVAL; } *memptr = allocator_aligned_alloc(allocator_get_global(), alignment, size); if (!*memptr) { return ENOMEM; } return 0; }
void *aligned_alloc(size_t alignment, size_t size) { if ((1 << log2_int(alignment)) != alignment) { errno = EINVAL; return NULL; } void* ret = allocator_aligned_alloc(allocator_get_global(), alignment, size); if (!ret) { errno = ENOMEM; } return ret; }