aboutsummaryrefslogtreecommitdiff
path: root/include/glib-compat.h
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-10-27 15:44:00 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-10-30 09:01:03 +0100
commit8681dffa91a0d5767b7c1eb3d5c2acbf7f7dd7ba (patch)
treee5252ad2632422f6d5b12b2e236ccb1be1ce1b71 /include/glib-compat.h
parentb9b03ab0d47e8cfc0015255c531db41d0b1a1f91 (diff)
glib: add compatibility interface for g_hash_table_add()
The next commit will use it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/glib-compat.h')
-rw-r--r--include/glib-compat.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/glib-compat.h b/include/glib-compat.h
index fb25f437b4..03d8b12675 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -165,6 +165,14 @@ static inline GThread *g_thread_new(const char *name,
#define CompatGCond GCond
#endif /* glib 2.31 */
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+/* Beware, function returns gboolean since 2.39.2, see GLib commit 9101915 */
+static inline void g_hash_table_add(GHashTable *hash_table, gpointer key)
+{
+ g_hash_table_replace(hash_table, key, key);
+}
+#endif
+
#ifndef g_assert_true
#define g_assert_true(expr) \
do { \