Skip to content

Commit

Permalink
glib-compat: add g_hash_table_steal_extended()
Browse files Browse the repository at this point in the history
Signed-off-by: László Várady <[email protected]>
  • Loading branch information
MrAnno authored and bazsi committed Dec 22, 2024
1 parent 85d7751 commit 7b049d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/compat/glib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions lib/compat/glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7b049d4

Please sign in to comment.