mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 14:20:16 +01:00
core: add compatibility wrapper for g_test_add_data_func_full() to nm-glib-compat.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
78edf6f581
commit
9ea3653f1f
1 changed files with 25 additions and 0 deletions
|
|
@ -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__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue