diff --git a/lib/compat/glib.c b/lib/compat/glib.c index d701e93ea..050cd55e8 100644 --- a/lib/compat/glib.c +++ b/lib/compat/glib.c @@ -297,3 +297,14 @@ g_utf8_get_char_validated_fixed(const gchar *p, gssize max_len) return g_utf8_get_char_validated(p, max_len); } #endif + + +#if !GLIB_CHECK_VERSION(2, 58, 0) +gboolean +slng_g_hash_table_steal_extended(GHashTable* hash_table, gconstpointer lookup_key, + gpointer* stolen_key, gpointer* stolen_value) +{ + g_hash_table_lookup_extended(hash_table, lookup_key, stolen_key, stolen_value); + return g_hash_table_steal(hash_table, lookup_key); +} +#endif diff --git a/lib/compat/glib.h b/lib/compat/glib.h index 18227fb66..ccb7406c6 100644 --- a/lib/compat/glib.h +++ b/lib/compat/glib.h @@ -68,4 +68,10 @@ gunichar g_utf8_get_char_validated_fixed (const gchar *p, gssize max_len); #define g_pattern_spec_match g_pattern_match #endif +#if !GLIB_CHECK_VERSION(2, 58, 0) +#define g_hash_table_steal_extended slng_g_hash_table_steal_extended +gboolean slng_g_hash_table_steal_extended(GHashTable* hash_table, gconstpointer lookup_key, + gpointer* stolen_key, gpointer* stolen_value); +#endif + #endif