diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-19 01:24:49 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-08-22 15:24:31 +0200 |
commit | 9ea3653f1f0c6d1a9f4456ea0f717fb62e80dd9e (patch) | |
tree | d28a2d7179cec5321261c5890312ff76d73d33c6 | |
parent | 78edf6f5816c4d39537c96c5653f8da6e8c7ec0c (diff) | |
download | NetworkManager-9ea3653f1f0c6d1a9f4456ea0f717fb62e80dd9e.tar.gz |
core: add compatibility wrapper for g_test_add_data_func_full() to nm-glib-compat.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | include/nm-glib-compat.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index 0489f3d8af..c8f1b5f11c 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -124,4 +124,29 @@ __nmtst_g_test_skip (const gchar *msg) } #define g_test_skip __nmtst_g_test_skip + +/* g_test_add_data_func_full() is only available since glib 2.34. Add a compatibility wrapper. */ +inline static void +__g_test_add_data_func_full (const char *testpath, + gpointer test_data, + GTestDataFunc test_func, + GDestroyNotify data_free_func) +{ +#if GLIB_CHECK_VERSION (2, 34, 0) + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + g_test_add_data_func_full (testpath, test_data, test_func, data_free_func); + G_GNUC_END_IGNORE_DEPRECATIONS +#else + g_return_if_fail (testpath != NULL); + g_return_if_fail (testpath[0] == '/'); + g_return_if_fail (test_func != NULL); + + g_test_add_vtable (testpath, 0, test_data, NULL, + (GTestFixtureFunc) test_func, + (GTestFixtureFunc) data_free_func); +#endif +} +#define g_test_add_data_func_full __g_test_add_data_func_full + + #endif /* __NM_GLIB_COMPAT_H__ */ |