[glib/ebassi/aligned-alloc] fixup! Add tests for g_aligned_alloc()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/ebassi/aligned-alloc] fixup! Add tests for g_aligned_alloc()
- Date: Fri, 11 Feb 2022 13:50:21 +0000 (UTC)
commit 0d2033171410a1e6f5a6f94b0be6af795bfc4a7a
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Feb 11 13:16:16 2022 +0000
fixup! Add tests for g_aligned_alloc()
glib/tests/mem-overflow.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c
index 8445caada..e6a1081d0 100644
--- a/glib/tests/mem-overflow.c
+++ b/glib/tests/mem-overflow.c
@@ -34,13 +34,14 @@ static gsize a = G_MAXSIZE / 10 + 10;
static gsize b = 10;
typedef char X[10];
-#define MEM_OVERFLOW_TEST(name, code) \
+#define MEM_OVERFLOW_TEST(name, code) MEM_OVERFLOW_TEST_FULL(name, code, g_free)
+#define MEM_OVERFLOW_TEST_FULL(name, code, free_func) \
static void \
mem_overflow_ ## name (void) \
{ \
gpointer p; \
code; \
- g_free (p); \
+ free_func (p); \
exit (0); \
}
@@ -68,8 +69,8 @@ MEM_OVERFLOW_TEST (new0_b, p = g_new0 (X, b))
MEM_OVERFLOW_TEST (renew_a, p = g_malloc (1); p = g_renew (X, p, a))
MEM_OVERFLOW_TEST (renew_b, p = g_malloc (1); p = g_renew (X, p, b))
-MEM_OVERFLOW_TEST (aligned_alloc_a, p = g_aligned_alloc (sizeof(X), a, 16))
-MEM_OVERFLOW_TEST (aligned_alloc_b, p = g_aligned_alloc (sizeof(X), b, 16))
+MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (sizeof(X), a, 16), g_aligned_free)
+MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (sizeof(X), b, 16), g_aligned_free)
static void
mem_overflow_malloc_0 (void)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]