aligned_alloc is now the same as BSD memalign

The resolution to DR 460 (which is explicitly included in C17) removed
the requirement for the size to be a multiple of the alignment.
pull/50/head
Daniel Micay 2018-09-06 16:30:22 -04:00
parent 0d3c2e1988
commit d8e18e0011
1 changed files with 1 additions and 9 deletions

View File

@ -909,20 +909,12 @@ EXPORT int h_posix_memalign(void **memptr, size_t alignment, size_t size) {
} }
EXPORT void *h_aligned_alloc(size_t alignment, size_t size) { EXPORT void *h_aligned_alloc(size_t alignment, size_t size) {
if (size % alignment) {
errno = EINVAL;
return NULL;
}
init(); init();
size = adjust_size_for_canaries(size); size = adjust_size_for_canaries(size);
return alloc_aligned_simple(alignment, size); return alloc_aligned_simple(alignment, size);
} }
EXPORT void *h_memalign(size_t alignment, size_t size) { EXPORT void *h_memalign(size_t alignment, size_t size) ALIAS(h_aligned_alloc);
init();
size = adjust_size_for_canaries(size);
return alloc_aligned_simple(alignment, size);
}
EXPORT void *h_valloc(size_t size) { EXPORT void *h_valloc(size_t size) {
init(); init();