diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-20 12:40:45 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-21 12:30:37 +0100 |
commit | 27d51c3250a54d19cd5bda1411450fbbb8218113 (patch) | |
tree | fd301f17322b98ab36f6e3e5fe2cb43fda1903b4 | |
parent | 74b2d6cadd1777da557f410ae79047c85dc2c888 (diff) | |
download | NetworkManager-27d51c3250a54d19cd5bda1411450fbbb8218113.tar.gz |
shared/glib: add compat implementation for g_hash_table_steal_extended()
-rw-r--r-- | shared/nm-glib-aux/nm-glib.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-glib.h b/shared/nm-glib-aux/nm-glib.h index dfb75bf05f..e7e69dc5fe 100644 --- a/shared/nm-glib-aux/nm-glib.h +++ b/shared/nm-glib-aux/nm-glib.h @@ -601,4 +601,32 @@ _g_atomic_pointer_compare_and_exchange (volatile void *atomic, /*****************************************************************************/ +#if !GLIB_CHECK_VERSION (2, 58, 0) +static inline gboolean +g_hash_table_steal_extended (GHashTable *hash_table, + gconstpointer lookup_key, + gpointer *stolen_key, + gpointer *stolen_value) +{ + if (g_hash_table_lookup_extended (hash_table, lookup_key, stolen_key, stolen_value)) { + g_hash_table_steal (hash_table, lookup_key); + return TRUE; + } + if (stolen_key) + *stolen_key = NULL; + if (stolen_value) + *stolen_value = NULL; + return FALSE; +} +#else +#define g_hash_table_steal_extended(hash_table, lookup_key, stolen_key, stolen_value) \ + ({ \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_hash_table_steal_extended (hash_table, lookup_key, stolen_key, stolen_value); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + }) +#endif + +/*****************************************************************************/ + #endif /* __NM_GLIB_H__ */ |