summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-21 18:30:09 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-21 18:30:09 +0000
commitf1c22fe6f3a7218c67556d5468c34fac00b0ed7b (patch)
treee7324b99de468d9ba33e2811b097f3a45781b9ff /contrib
parentff4acb5109bb78fb2af867ec880ac8b8a4d3768b (diff)
downloadrspamd-f1c22fe6f3a7218c67556d5468c34fac00b0ed7b.tar.gz
rspamd-f1c22fe6f3a7218c67556d5468c34fac00b0ed7b.zip
Add legacy XXH32_init.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/xxhash/xxhash.c11
-rw-r--r--contrib/xxhash/xxhash.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/contrib/xxhash/xxhash.c b/contrib/xxhash/xxhash.c
index 24a64b5f8..15064f9fb 100644
--- a/contrib/xxhash/xxhash.c
+++ b/contrib/xxhash/xxhash.c
@@ -531,6 +531,15 @@ XXH32_state_t* XXH32_createState(void)
XXH_STATIC_ASSERT(sizeof(XXH32_state_t) >= sizeof(XXH_istate32_t)); // A compilation error here means XXH32_state_t is not large enough
return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t));
}
+
+void* XXH32_init (unsigned seed)
+{
+ XXH32_state_t *st = XXH32_createState();
+ XXH32_reset(st, seed);
+
+ return st;
+}
+
XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
{
XXH_free(statePtr);
@@ -717,6 +726,7 @@ FORCE_INLINE U32 XXH32_digest_endian (const XXH32_state_t* state_in, XXH_endiane
h32 *= PRIME32_3;
h32 ^= h32 >> 16;
+ XXH32_freeState((XXH32_state_t *)state_in);
return h32;
}
@@ -911,6 +921,7 @@ FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state_in, XXH_endiane
h64 *= PRIME64_3;
h64 ^= h64 >> 32;
+ XXH64_freeState((XXH64_state_t *)state_in);
return h64;
}
diff --git a/contrib/xxhash/xxhash.h b/contrib/xxhash/xxhash.h
index 55b45015a..4a41bfbf8 100644
--- a/contrib/xxhash/xxhash.h
+++ b/contrib/xxhash/xxhash.h
@@ -110,6 +110,12 @@ States must then be initialized using XXHnn_reset() before first use.
If you prefer dynamic allocation, please refer to functions below.
*/
+/*
+ * !!!
+ * Rspamd specific: we use the legacy method to free state when digest is obtained
+ * !!!
+ */
+void * XXH32_init (unsigned seed);
XXH32_state_t* XXH32_createState(void);
XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr);