From: Vsevolod Stakhov Date: Tue, 8 Dec 2015 00:55:09 +0000 (+0000) Subject: Add routine to compare to rspamd_regexp_t X-Git-Tag: 1.1.0~379 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b19163b84133ada0ff04581065905be7a7436d96;p=thirdparty%2Frspamd.git Add routine to compare to rspamd_regexp_t --- diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 530574100e..2fe614e90a 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -594,6 +594,14 @@ rspamd_regexp_hash (gconstpointer a) return res; } +gboolean +rspamd_regexp_cmp (gconstpointer a, gconstpointer b) +{ + const guchar *ia = a, *ib = b; + + return memcmp (ia, ib, sizeof (regexp_id_t)); +} + struct rspamd_regexp_cache* rspamd_regexp_cache_new (void) { diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h index a67bef9906..a64f36e1a3 100644 --- a/src/libutil/regexp.h +++ b/src/libutil/regexp.h @@ -213,6 +213,11 @@ guint32 rspamd_regexp_hash (gconstpointer a); */ gboolean rspamd_regexp_equal (gconstpointer a, gconstpointer b); +/** + * Acts like memcmp but for regexp + */ +gint rspamd_regexp_cmp (gconstpointer a, gconstpointer b); + /** * Initialize superglobal regexp cache and library */