diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-06 13:55:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-06 13:55:43 +0000 |
commit | 958cbf047b81c507d3d73deddaf1ee48a36e6415 (patch) | |
tree | ef8c1749a247ffa1262d454bd78f4a00364ed5e8 /src | |
parent | 13016e9b0e3eebb9145d7cf08f9d517e6e5b8688 (diff) | |
download | rspamd-958cbf047b81c507d3d73deddaf1ee48a36e6415.tar.gz rspamd-958cbf047b81c507d3d73deddaf1ee48a36e6415.zip |
Add method to set re class for any rspamd regexp
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/regexp.c | 22 | ||||
-rw-r--r-- | src/libutil/regexp.h | 11 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 00c60a337..530574100 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -51,6 +51,7 @@ struct rspamd_regexp_s { regexp_id_t id; ref_entry_t ref; gpointer ud; + gpointer re_class; guint64 cache_id; gint flags; gint ncaptures; @@ -747,3 +748,24 @@ rspamd_regexp_get_id (rspamd_regexp_t *re) return re->id; } + +gpointer +rspamd_regexp_get_class (rspamd_regexp_t *re) +{ + g_assert (re != NULL); + + return re->re_class; +} + +gpointer +rspamd_regexp_set_class (rspamd_regexp_t *re, gpointer re_class) +{ + gpointer old_class; + + g_assert (re != NULL); + + old_class = re->re_class; + re->re_class = re_class; + + return old_class; +} diff --git a/src/libutil/regexp.h b/src/libutil/regexp.h index cf012668a..a67bef990 100644 --- a/src/libutil/regexp.h +++ b/src/libutil/regexp.h @@ -133,6 +133,17 @@ guint64 rspamd_regexp_get_cache_id (rspamd_regexp_t *re); guint64 rspamd_regexp_set_cache_id (rspamd_regexp_t *re, guint64 id); /** + * Get regexp class for the re object + */ +gpointer rspamd_regexp_get_class (rspamd_regexp_t *re); + +/** + * Set regexp class for the re object + * @return old re class value + */ +gpointer rspamd_regexp_set_class (rspamd_regexp_t *re, gpointer re_class); + +/** * Create new regexp cache * @return */ |