1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-17 18:21:03 +03:00

aligned_alloc: conform to C17

This patch adds the strict checking for power-of-two alignments
in aligned_alloc(), and updates the manual accordingly.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
DJ Delorie
2023-03-21 00:46:43 -04:00
parent cea74a4a24
commit d1417176a3
6 changed files with 117 additions and 7 deletions

View File

@ -299,7 +299,14 @@ __debug_memalign (size_t alignment, size_t bytes)
return _debug_mid_memalign (alignment, bytes, RETURN_ADDRESS (0));
}
strong_alias (__debug_memalign, memalign)
strong_alias (__debug_memalign, aligned_alloc)
static void *
__debug_aligned_alloc (size_t alignment, size_t bytes)
{
if (!powerof2 (alignment) || alignment == 0)
return NULL;
return _debug_mid_memalign (alignment, bytes, RETURN_ADDRESS (0));
}
strong_alias (__debug_aligned_alloc, aligned_alloc)
static void *
__debug_pvalloc (size_t bytes)