From 68d3b04aaa1960e900ef3f4e72e1f38d3265ff52 Mon Sep 17 00:00:00 2001 From: olavmrk Date: Wed, 8 May 2013 12:24:19 +0000 Subject: Move GLib compatibility helpers to a separate file. git-svn-id: https://modmellon.googlecode.com/svn/trunk@207 a716ebb1-153a-0410-b759-cfb97c6a1b53 --- Makefile.in | 2 +- auth_mellon.h | 26 ++++---------------------- auth_mellon_compat.h | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 auth_mellon_compat.h diff --git a/Makefile.in b/Makefile.in index fff8a9a..8945a00 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,7 +21,7 @@ DISTFILES=$(SRC) \ all: mod_auth_mellon.la -mod_auth_mellon.la: $(SRC) auth_mellon.h +mod_auth_mellon.la: $(SRC) auth_mellon.h auth_mellon_compat.h @APXS2@ -Wc,"@OPENSSL_CFLAGS@ @LASSO_CFLAGS@ @CURL_CFLAGS@ @GLIB_CFLAGS@" -Wl,"@OPENSSL_LIBS@ @LASSO_LIBS@ @CURL_LIBS@ @GLIB_LIBS@" -Wc,-Wall -Wc,-g -c $(SRC) diff --git a/auth_mellon.h b/auth_mellon.h index c4e40d9..2daacbe 100644 --- a/auth_mellon.h +++ b/auth_mellon.h @@ -64,6 +64,10 @@ #include "mod_ssl.h" +/* Backwards-compatibility helpers. */ +#include "auth_mellon_compat.h" + + /* Size definitions for the session cache. */ #define AM_CACHE_KEYSIZE 120 @@ -379,26 +383,4 @@ int am_httpclient_post_str(request_rec *r, const char *uri, extern module AP_MODULE_DECLARE_DATA auth_mellon_module; -/* 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 /* MOD_AUTH_MELLON_H */ 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 + +/* 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 */ -- cgit