mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 10:40:58 +01:00
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));
This commit is contained in:
parent
1b9d60f985
commit
caeaa78918
1 changed files with 7 additions and 14 deletions
|
|
@ -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__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue