From 033d4b2d749fca44e4b067f9a5486a289b61a95e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 19 Mar 2015 18:43:03 +0000 Subject: Use regexp hash functions for task re_cache. --- src/libutil/regexp.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/libutil/regexp.h') diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h index 3c08de71a..fc236c1b3 100644 --- a/src/libutil/regexp.h +++ b/src/libutil/regexp.h @@ -89,6 +89,13 @@ void rspamd_regexp_set_ud (rspamd_regexp_t *re, gpointer ud); */ gpointer rspamd_regexp_get_ud (rspamd_regexp_t *re); +/** + * Get regexp ID suitable for hashing + * @param re + * @return + */ +gpointer rspamd_regexp_get_id (rspamd_regexp_t *re); + /** * Get pattern for the specified regexp object * @param re @@ -151,6 +158,21 @@ gboolean rspamd_regexp_cache_remove (struct rspamd_regexp_cache *cache, */ void rspamd_regexp_cache_destroy (struct rspamd_regexp_cache *cache); +/** + * Return the value for regexp hash based on its ID + * @param a + * @return + */ +guint32 rspamd_regexp_hash (gconstpointer a); + +/** + * Compare two regexp objects based on theirs ID + * @param a + * @param b + * @return + */ +gboolean rspamd_regexp_equal (gconstpointer a, gconstpointer b); + /** * Initialize superglobal regexp cache and library */ -- cgit v1.2.3