mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
tests/gvariant.c: ensure posix_memalign alignment argument is correct
posix_memalign() requires the alignment to be a multiple of sizeof(void*), and a power of 2. Passing 8 does not fulfil both of those constraints on Arm Morello which resulted in a "posix_memalign failed" test failure. Co-authored-by: Graeme Jenkinson <graeme@capabilitieslimited.co.uk>
This commit is contained in:
parent
ded3099afc
commit
34236af33c
@ -1340,7 +1340,9 @@ align_malloc (gsize size)
|
||||
gpointer mem;
|
||||
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
if (posix_memalign (&mem, 8, size))
|
||||
/* posix_memalign() requires the alignment to be a multiple of
|
||||
* sizeof(void*), and a power of 2. */
|
||||
if (posix_memalign (&mem, MAX (sizeof (void *), 8), size))
|
||||
g_error ("posix_memalign failed");
|
||||
#else
|
||||
/* NOTE: there may be platforms that lack posix_memalign() and also
|
||||
|
Loading…
Reference in New Issue
Block a user