mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02: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:
@@ -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
|
||||
|
Reference in New Issue
Block a user