mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
Merge branch 'posix_memalign-requirements' into 'main'
tests/gvariant.c: ensure posix_memalign alignment argument is correct See merge request GNOME/glib!3145
This commit is contained in:
commit
0e3b21000d
@ -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
|
||||
|
@ -1086,13 +1086,13 @@ test_aligned_mem (void)
|
||||
|
||||
g_test_summary ("Aligned memory allocator");
|
||||
|
||||
a = g_aligned_alloc (0, sizeof(int), 8);
|
||||
a = g_aligned_alloc (0, sizeof (int), MAX (sizeof (void *), 8));
|
||||
g_assert_null (a);
|
||||
|
||||
a = g_aligned_alloc0 (0, sizeof(int), 8);
|
||||
a = g_aligned_alloc0 (0, sizeof (int), MAX (sizeof (void *), 8));
|
||||
g_assert_null (a);
|
||||
|
||||
a = g_aligned_alloc (16, 0, 8);
|
||||
a = g_aligned_alloc (16, 0, MAX (sizeof (void *), 8));
|
||||
g_assert_null (a);
|
||||
|
||||
#define CHECK_SUBPROCESS_FAIL(name,msg) do { \
|
||||
|
Loading…
Reference in New Issue
Block a user