From 2283cd98f94cafbab679afa5bc1d499578b0d120 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 15 Jun 2020 15:56:30 +0200 Subject: [PATCH] glib: always re-implement g_steal_pointer() g_steal_pointer() is marked as GLIB_AVAILABLE_STATIC_INLINE_IN_2_44, that means we get a deprecated warning. Avoid that. We anyway re-implement the macro so that we can use it before 2.44 and so that it always does the typeof() cast. (cherry picked from commit edfe9fa9a23422b54438c49588562b0838d80908) (cherry picked from commit 6936a0613cdd0d850238e1ebe5260de9332a9198) (cherry picked from commit e333a28b976f4d7936f69da4a6109d47bb470ea9) --- shared/nm-glib-aux/nm-glib.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shared/nm-glib-aux/nm-glib.h b/shared/nm-glib-aux/nm-glib.h index 33cd50f44d..45f2c50a3c 100644 --- a/shared/nm-glib-aux/nm-glib.h +++ b/shared/nm-glib-aux/nm-glib.h @@ -411,9 +411,8 @@ _nm_g_hash_table_get_keys_as_array (GHashTable *hash_table, /*****************************************************************************/ -#if !GLIB_CHECK_VERSION(2, 44, 0) static inline gpointer -g_steal_pointer (gpointer pp) +_nm_g_steal_pointer (gpointer pp) { gpointer *ptr = (gpointer *) pp; gpointer ref; @@ -423,13 +422,20 @@ g_steal_pointer (gpointer pp) return ref; } + +#if !GLIB_CHECK_VERSION(2, 44, 0) +static inline gpointer +g_steal_pointer (gpointer pp) +{ + return _nm_g_steal_pointer (pp); +} #endif #ifdef g_steal_pointer #undef g_steal_pointer #endif #define g_steal_pointer(pp) \ - ((typeof (*(pp))) g_steal_pointer (pp)) + ((typeof (*(pp))) _nm_g_steal_pointer (pp)) /*****************************************************************************/