From: Vsevolod Stakhov Date: Tue, 1 Dec 2015 15:38:10 +0000 (+0000) Subject: Add support of g_int64 hash for old glib X-Git-Tag: 1.1.0~438 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e50ff44d757e06bf0c17f7bd6a7b834a3285d37d;p=thirdparty%2Frspamd.git Add support of g_int64 hash for old glib --- diff --git a/src/libutil/util.c b/src/libutil/util.c index fee039c85f..10b3889777 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1327,6 +1327,18 @@ g_ptr_array_unref (GPtrArray *array) { g_ptr_array_free (array, TRUE); } +gboolean +g_int64_equal (gconstpointer v1, gconstpointer v2) +{ + return *((const gint64*) v1) == *((const gint64*) v2); +} +guint +g_int64_hash (gconstpointer v) +{ + guint64 v64 = *(guint64 *)v; + + return (guint) (v ^ (v >> 32)); +} #endif #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)) void diff --git a/src/libutil/util.h b/src/libutil/util.h index c2e0f1605a..ab1d205c10 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -177,6 +177,8 @@ void gperf_profiler_stop (void); */ #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 22)) void g_ptr_array_unref (GPtrArray *array); +gboolean g_int64_equal (gconstpointer v1, gconstpointer v2); +guint g_int64_hash (gconstpointer v); #endif #if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 14)) void g_queue_clear (GQueue *queue);