mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 02:10:09 +01:00
nm-glib: backport g_steal_pointer() from glib-2.44
(cherry picked from commit 5d1c4ca6c4)
This commit is contained in:
parent
7d2458e51c
commit
cd0dd3b0bf
1 changed files with 18 additions and 0 deletions
|
|
@ -374,4 +374,22 @@ _nm_g_hash_table_get_keys_as_array (GHashTable *hash_table,
|
|||
__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 44, 0)
|
||||
static inline gpointer
|
||||
g_steal_pointer (gpointer pp)
|
||||
{
|
||||
gpointer *ptr = (gpointer *) pp;
|
||||
gpointer ref;
|
||||
|
||||
ref = *ptr;
|
||||
*ptr = NULL;
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* type safety */
|
||||
#define g_steal_pointer(pp) \
|
||||
(0 ? (*(pp)) : (g_steal_pointer) (pp))
|
||||
#endif
|
||||
|
||||
#endif /* __NM_GLIB_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue