summaryrefslogtreecommitdiffstats
path: root/auth_mellon_compat.h
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2013-05-08 12:24:19 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2013-05-08 12:24:19 +0000
commit68d3b04aaa1960e900ef3f4e72e1f38d3265ff52 (patch)
treedb9b12e807058458ca1e90e049b4e5c95a8e2e94 /auth_mellon_compat.h
parent58c0029c34de146aff55eda4b1d1c1dca1db5d0e (diff)
downloadmod_auth_mellon-68d3b04aaa1960e900ef3f4e72e1f38d3265ff52.tar.gz
mod_auth_mellon-68d3b04aaa1960e900ef3f4e72e1f38d3265ff52.tar.xz
mod_auth_mellon-68d3b04aaa1960e900ef3f4e72e1f38d3265ff52.zip
Move GLib compatibility helpers to a separate file.
git-svn-id: https://modmellon.googlecode.com/svn/trunk@207 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_compat.h')
-rw-r--r--auth_mellon_compat.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/auth_mellon_compat.h b/auth_mellon_compat.h
new file mode 100644
index 0000000..f521d5b
--- /dev/null
+++ b/auth_mellon_compat.h
@@ -0,0 +1,27 @@
+#ifndef AUTH_MELLON_COMPAT_H
+#define AUTH_MELLON_COMPAT_H
+
+#include <glib.h>
+
+/* Old glib compatibility */
+#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)
+
+static void g_hash_table_get_keys_helper(gpointer key, gpointer value,
+ gpointer user_data)
+{
+ GList **out = user_data;
+
+ *out = g_list_prepend(*out, key);
+}
+
+static GList *g_hash_table_get_keys(GHashTable *ht)
+{
+ GList *ret = NULL;
+
+ g_hash_table_foreach(ht, g_hash_table_get_keys_helper, &ret);
+
+ return g_list_reverse(ret);
+}
+#endif
+
+#endif /* AUTH_MELLON_COMPAT_H */