aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-06 13:59:07 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-06 13:59:07 +0000
commit9bc218c25f142a973206869d57275f3cae9a2184 (patch)
tree10f4a2abcba2f89dba64b8e2d4d39b84f0c6b79a /src/libutil/regexp.c
parent453645aa3766bd1e5df8d9bb076f78bf3604e1d8 (diff)
downloadrspamd-9bc218c25f142a973206869d57275f3cae9a2184.tar.gz
rspamd-9bc218c25f142a973206869d57275f3cae9a2184.zip
Implement lua regexp split, write test case.
Diffstat (limited to 'src/libutil/regexp.c')
-rw-r--r--src/libutil/regexp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 444496f45..6da0a663e 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -488,12 +488,27 @@ rspamd_regexp_cache_create (struct rspamd_regexp_cache *cache,
res = rspamd_regexp_new (pattern, flags, err);
if (res) {
+ REF_RETAIN (res);
g_hash_table_insert (cache->tbl, res->id, res);
}
return res;
}
+gboolean
+rspamd_regexp_cache_remove (struct rspamd_regexp_cache *cache,
+ rspamd_regexp_t *re)
+{
+ if (cache == NULL) {
+ cache = global_re_cache;
+ }
+
+ g_assert (cache != NULL);
+ g_assert (re != NULL);
+
+ return g_hash_table_remove (cache->tbl, re->id);
+}
+
void
rspamd_regexp_cache_destroy (struct rspamd_regexp_cache *cache)
{