Skip to content

Commit 83c7160

Browse files
committed
glib-compat: add g_hash_table_steal_extended()
Signed-off-by: László Várady <[email protected]>
1 parent fa3fcc5 commit 83c7160

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/compat/glib.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,14 @@ g_utf8_get_char_validated_fixed(const gchar *p, gssize max_len)
297297
return g_utf8_get_char_validated(p, max_len);
298298
}
299299
#endif
300+
301+
302+
#if !GLIB_CHECK_VERSION(2, 58, 0)
303+
gboolean
304+
slng_g_hash_table_steal_extended(GHashTable *hash_table, gconstpointer lookup_key,
305+
gpointer *stolen_key, gpointer *stolen_value)
306+
{
307+
g_hash_table_lookup_extended(hash_table, lookup_key, stolen_key, stolen_value);
308+
return g_hash_table_steal(hash_table, lookup_key);
309+
}
310+
#endif

lib/compat/glib.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,10 @@ gunichar g_utf8_get_char_validated_fixed (const gchar *p, gssize max_len);
6868
#define g_pattern_spec_match g_pattern_match
6969
#endif
7070

71+
#if !GLIB_CHECK_VERSION(2, 58, 0)
72+
#define g_hash_table_steal_extended slng_g_hash_table_steal_extended
73+
gboolean slng_g_hash_table_steal_extended(GHashTable *hash_table, gconstpointer lookup_key,
74+
gpointer *stolen_key, gpointer *stolen_value);
75+
#endif
76+
7177
#endif

0 commit comments

Comments
 (0)