From a8ba838fc116cade384bbadb013fc181121d480b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 16 Nov 2015 16:44:33 +0000 Subject: [PATCH] Add another bloody workaround for old glib --- src/libutil/util.c | 16 ++++++++++++++++ src/libutil/util.h | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libutil/util.c b/src/libutil/util.c index ed9d78abe5..286ec5091f 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1352,6 +1352,22 @@ g_ptr_array_new_full (guint reserved_size, return array; } #endif +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 32)) +void +g_queue_free_full (GQueue *queue, GDestroyNotify free_func) +{ + GList *cur; + + cur = queue->head; + + while (cur) { + free_func (cur->data); + cur = g_list_next (cur); + } + + g_queue_free (queue); +} +#endif guint rspamd_url_hash (gconstpointer u) diff --git a/src/libutil/util.h b/src/libutil/util.h index 75aa4850ad..c2e0f1605a 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -181,7 +181,9 @@ void g_ptr_array_unref (GPtrArray *array); #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)) void g_queue_clear (GQueue *queue); #endif - +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 32)) +void g_queue_free_full (GQueue *queue, GDestroyNotify free_func); +#endif /* * Convert milliseconds to timeval fields -- 2.47.3