aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-09 14:34:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-09 14:34:39 +0000
commitb6408a3c963d1bd73931d07004e99d921672d615 (patch)
tree564282d917690770cfb8237c6c2109b5ce2d0969 /src/libutil
parent86998b26779a19668828aca9753a7551d2a0daf7 (diff)
downloadrspamd-b6408a3c963d1bd73931d07004e99d921672d615.tar.gz
rspamd-b6408a3c963d1bd73931d07004e99d921672d615.zip
Store max hits inside rspamd_regexp_t
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/regexp.c22
-rw-r--r--src/libutil/regexp.h10
2 files changed, 32 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 9db031109..39ff5ebf2 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -53,6 +53,7 @@ struct rspamd_regexp_s {
gpointer ud;
gpointer re_class;
guint64 cache_id;
+ guint max_hits;
gint flags;
gint pcre_flags;
gint ncaptures;
@@ -250,6 +251,7 @@ fin:
res->pattern = real_pattern;
res->cache_id = RSPAMD_INVALID_ID;
res->pcre_flags = regexp_flags;
+ res->max_hits = 0;
if (rspamd_flags & RSPAMD_REGEXP_FLAG_RAW) {
res->raw_re = r;
@@ -523,6 +525,26 @@ rspamd_regexp_get_ncaptures (rspamd_regexp_t *re)
return re->ncaptures;
}
+guint
+rspamd_regexp_get_maxhits (rspamd_regexp_t *re)
+{
+ g_assert (re != NULL);
+
+ return re->max_hits;
+}
+
+guint
+rspamd_regexp_set_maxhits (rspamd_regexp_t *re, guint new_maxhits)
+{
+ guint old_hits;
+
+ g_assert (re != NULL);
+ old_hits = re->max_hits;
+ re->max_hits = new_maxhits;
+
+ return old_hits;
+}
+
guint64
rspamd_regexp_get_cache_id (rspamd_regexp_t *re)
{
diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h
index 8d3720f3e..0b585ceec 100644
--- a/src/libutil/regexp.h
+++ b/src/libutil/regexp.h
@@ -122,6 +122,16 @@ guint rspamd_regexp_get_pcre_flags (rspamd_regexp_t *re);
guint rspamd_regexp_get_flags (rspamd_regexp_t *re);
/**
+ * Set regexp maximum hits
+ */
+guint rspamd_regexp_get_maxhits (rspamd_regexp_t *re);
+
+/**
+ * Get regexp maximum hits
+ */
+guint rspamd_regexp_set_maxhits (rspamd_regexp_t *re, guint new_maxhits);
+
+/**
* Returns number of backreferences in a regexp
*/
gint rspamd_regexp_get_nbackrefs (rspamd_regexp_t *re);