diff options
author | Thomas Haller <thaller@redhat.com> | 2016-06-17 12:02:22 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-06-17 12:25:33 +0200 |
commit | caeaa789185b78d5fd88b4e7d61e0a517ae97175 (patch) | |
tree | 3273d53f97ea5b1961038d635bb2c796124fd1b1 /shared | |
parent | 1b9d60f9851459c00a9d8a26afb74c9ffc4881fe (diff) | |
download | NetworkManager-caeaa789185b78d5fd88b4e7d61e0a517ae97175.tar.gz |
nm-glib: implement compatibility macro for g_strv_contains() differently
Otherwise, deprecation warnings are not properly suppressed for
g_return_if_fail (g_strv_contains (strv, str));
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-utils/nm-glib.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h index b9fc5c298d..2818074d68 100644 --- a/shared/nm-utils/nm-glib.h +++ b/shared/nm-utils/nm-glib.h @@ -394,11 +394,12 @@ g_steal_pointer (gpointer pp) (0 ? (*(pp)) : (g_steal_pointer) (pp)) #endif -#if !GLIB_CHECK_VERSION(2, 44, 0) || defined (NM_GLIB_COMPAT_H_TEST) + static inline gboolean _nm_g_strv_contains (const gchar * const *strv, const gchar *str) { +#if !GLIB_CHECK_VERSION(2, 44, 0) g_return_val_if_fail (strv != NULL, FALSE); g_return_val_if_fail (str != NULL, FALSE); @@ -408,20 +409,12 @@ _nm_g_strv_contains (const gchar * const *strv, } return FALSE; -} -#endif -#if !GLIB_CHECK_VERSION(2, 44, 0) -#define g_strv_contains(strv, str) \ - ({ \ - _nm_g_strv_contains (strv, str); \ - }) #else -#define g_strv_contains(strv, str) \ - ({ \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - (g_strv_contains) ((strv), (str)); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - }) + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + return g_strv_contains (strv, str); + G_GNUC_END_IGNORE_DEPRECATIONS #endif +} +#define g_strv_contains _nm_g_strv_contains #endif /* __NM_GLIB_H__ */ |