From: Vsevolod Stakhov Date: Mon, 29 Sep 2014 23:26:03 +0000 (+0100) Subject: Use xxhash for repeating log messages. X-Git-Tag: 0.7.1~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2c68a5e0180dc10f727789275b1a13ad2fa47de3;p=rspamd.git Use xxhash for repeating log messages. --- 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