summaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-07 13:59:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-07 15:04:29 +0100
commit6ac62f6509c0cbb17486e935f63d6e519b37c730 (patch)
tree5a5e0086de8aadedfd817b26564e0c36dc744968 /src/libserver
parent97f1081511d5e13568aa81415343d84e1b7d7bf8 (diff)
downloadrspamd-6ac62f6509c0cbb17486e935f63d6e519b37c730.tar.gz
rspamd-6ac62f6509c0cbb17486e935f63d6e519b37c730.zip
Allow stateless trie search.
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/url.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 41ecb7dd2..5e2bd4044 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1421,16 +1421,27 @@ rspamd_url_find (rspamd_mempool_t *pool,
gint *statep)
{
struct url_callback_data cb;
- gint ret;
+ gint ret, state;
- g_assert (statep != NULL);
memset (&cb, 0, sizeof (cb));
cb.begin = begin;
cb.end = begin + len;
cb.is_html = is_html;
cb.pool = pool;
+
+ if (statep != NULL) {
+ state = *statep;
+ }
+ else {
+ state = 0;
+ }
+
ret = acism_lookup (url_scanner->search_trie, begin, len,
- rspamd_url_trie_callback, &cb, statep, true);
+ rspamd_url_trie_callback, &cb, &state, true);
+
+ if (statep) {
+ *statep = state;
+ }
if (ret) {
if (start) {