[NetworkManager-openconnect/lr/gtk-4.0: 1/13] shared/nm-glib: add our own g_steal_pointer() macro to shadow the one from glib
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openconnect/lr/gtk-4.0: 1/13] shared/nm-glib: add our own g_steal_pointer() macro to shadow the one from glib
- Date: Fri, 14 Jan 2022 18:21:52 +0000 (UTC)
commit 27cfe93cdbeb7f8f6d65672c987928591b3fed2d
Author: Thomas Haller <thaller redhat com>
Date: Wed Feb 20 14:35:47 2019 +0100
shared/nm-glib: add our own g_steal_pointer() macro to shadow the one from glib
g_steal_pointer() as provided by glib improved significantly. Nowadays it
casts the return type via the non-standard typeof() operator.
But this useful feature is only enabled with
GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58
which NetworkManager does not set.
This macro is hardly rocket science. Always provide our own
implementation, that always does the casting (we rely on gcc/clang
to support typeof() already at many places).
(imported from NetworkManager commit 6c07faa0131fd1795814f53dd34c18ed41d4ac2a)
shared/nm-utils/nm-glib.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h
index 2818074..d57e87c 100644
--- a/shared/nm-utils/nm-glib.h
+++ b/shared/nm-utils/nm-glib.h
@@ -388,11 +388,13 @@ g_steal_pointer (gpointer pp)
return ref;
}
+#endif
-/* type safety */
-#define g_steal_pointer(pp) \
- (0 ? (*(pp)) : (g_steal_pointer) (pp))
+#ifdef g_steal_pointer
+#undef g_steal_pointer
#endif
+#define g_steal_pointer(pp) \
+ ((typeof (*(pp))) g_steal_pointer (pp))
static inline gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]