mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 05:13:06 +02: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;
|
gpointer mem;
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_MEMALIGN
|
#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");
|
g_error ("posix_memalign failed");
|
||||||
#else
|
#else
|
||||||
/* NOTE: there may be platforms that lack posix_memalign() and also
|
/* 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");
|
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);
|
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);
|
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);
|
g_assert_null (a);
|
||||||
|
|
||||||
#define CHECK_SUBPROCESS_FAIL(name,msg) do { \
|
#define CHECK_SUBPROCESS_FAIL(name,msg) do { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user