From 2c68a5e0180dc10f727789275b1a13ad2fa47de3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 30 Sep 2014 00:26:03 +0100 Subject: [PATCH] Use xxhash for repeating log messages. --- src/libutil/logger.c | 16 ++-------------- src/rdns | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/libutil/logger.c b/src/libutil/logger.c index c91d56982..54968ac58 100644 --- a/src/libutil/logger.c +++ b/src/libutil/logger.c @@ -28,6 +28,7 @@ #include "util.h" #include "main.h" #include "map.h" +#include "xxhash.h" /* How much message should be repeated before it is count to be repeated one */ #define REPEATS_MIN 3 @@ -83,20 +84,7 @@ file_log_function (const gchar * log_domain, const gchar *function, static inline guint32 rspamd_log_calculate_cksum (const gchar *message, size_t mlen) { - const gchar *bp = message; - const gchar *be = bp + mlen; - guint32 hval = 0; - - while (bp < be) { - hval += - (hval << - 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); - hval ^= (guint32) * bp++; - } - - /* return our new hash value */ - return hval; - + return XXH32 (message, mlen, 0xdeadbeef); } /* diff --git a/src/rdns b/src/rdns index a21b4c0af..8d80ac78c 160000 --- a/src/rdns +++ b/src/rdns @@ -1 +1 @@ -Subproject commit a21b4c0afc2c4bd7a2a16fbd6ba05033c926f6c2 +Subproject commit 8d80ac78cf6436c077804dd0972866a5bd55732f -- 2.39.5