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.
This commit is contained in:
Daniel Micay 2018-09-06 16:30:22 -04:00
parent 0d3c2e1988
commit d8e18e0011

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) {
if (size % alignment) {
errno = EINVAL;
return NULL;
}
init();
size = adjust_size_for_canaries(size);
return alloc_aligned_simple(alignment, size);
}
EXPORT void *h_memalign(size_t alignment, size_t size) {
init();
size = adjust_size_for_canaries(size);
return alloc_aligned_simple(alignment, size);
}
EXPORT void *h_memalign(size_t alignment, size_t size) ALIAS(h_aligned_alloc);
EXPORT void *h_valloc(size_t size) {
init();