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 <laszlo.varady@anno.io>
  • Loading branch information
MrAnno committed Nov 19, 2024
1 parent fa3fcc5 commit 83c7160
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 83c7160

Please sign in to comment.