[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/28] glib-compat: add g_test_add_data_func_full fal
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PULL 05/28] glib-compat: add g_test_add_data_func_full fallback |
Date: |
Wed, 1 Mar 2017 13:04:30 +0400 |
Move the fallback from qtest_add_data_func_full() to glib-compat.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
include/glib-compat.h | 21 +++++++++++++++++++++
tests/libqtest.c | 10 ----------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 0cd24ffbe9..863c8cf73d 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -328,4 +328,25 @@ static inline void g_source_set_name_by_id(guint tag,
const char *name)
#define g_test_subprocess() (0)
#endif
+
+#if !GLIB_CHECK_VERSION(2, 34, 0)
+static inline void
+g_test_add_data_func_full(const char *path,
+ gpointer data,
+ gpointer fn,
+ gpointer data_free_func)
+{
+#if GLIB_CHECK_VERSION(2, 26, 0)
+ /* back-compat casts, remove this once we can require new-enough glib */
+ g_test_add_vtable(path, 0, data, NULL,
+ (GTestFixtureFunc)fn, (GTestFixtureFunc) data_free_func);
+#else
+ /* back-compat casts, remove this once we can require new-enough glib */
+ g_test_add_vtable(path, 0, data, NULL,
+ (void (*)(void)) fn, (void (*)(void)) data_free_func);
+#endif
+}
+#endif
+
+
#endif
diff --git a/tests/libqtest.c b/tests/libqtest.c
index e54354de8a..3a0e0d63a7 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -805,17 +805,7 @@ void qtest_add_data_func_full(const char *str, void *data,
GDestroyNotify data_free_func)
{
gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
-#if GLIB_CHECK_VERSION(2, 34, 0)
g_test_add_data_func_full(path, data, fn, data_free_func);
-#elif GLIB_CHECK_VERSION(2, 26, 0)
- /* back-compat casts, remove this once we can require new-enough glib */
- g_test_add_vtable(path, 0, data, NULL,
- (GTestFixtureFunc)fn, (GTestFixtureFunc) data_free_func);
-#else
- /* back-compat casts, remove this once we can require new-enough glib */
- g_test_add_vtable(path, 0, data, NULL,
- (void (*)(void)) fn, (void (*)(void)) data_free_func);
-#endif
g_free(path);
}
--
2.12.0.rc2.3.gc93709801
- [Qemu-devel] [PULL 00/28] Leak patches, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 01/28] qtest: fix a memory leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 02/28] tests: fix qmp response leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 03/28] tests: fix leaks in test-io-channel-command, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 04/28] timer: use an inline function for free, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 05/28] glib-compat: add g_test_add_data_func_full fallback,
Marc-André Lureau <=
- [Qemu-devel] [PULL 06/28] tests: fix ptimer leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 07/28] tests: fix endianness-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 08/28] tests: fix q35-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 09/28] tests: fix vhost-user-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 10/28] tests: fix ide-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 12/28] tests: fix bios-tables-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 11/28] tests: fix hd-geo-test leaks, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 13/28] tests: fix ipmi-kcs-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 14/28] tests: fix ipmi-bt-test leak, Marc-André Lureau, 2017/03/01
- [Qemu-devel] [PULL 15/28] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice, Marc-André Lureau, 2017/03/01