diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-06 18:03:49 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-06 18:03:49 +0100 |
commit | d6724d926dcbc2fd204f989c1b71b6a0cc52e02a (patch) | |
tree | de48a40a35cbcd6149dcd1e7dc6f2f57ec60b3c3 /contrib | |
parent | 680a2b66cbb66a52b72e18895236ccafe2791c84 (diff) | |
download | rspamd-d6724d926dcbc2fd204f989c1b71b6a0cc52e02a.tar.gz rspamd-d6724d926dcbc2fd204f989c1b71b6a0cc52e02a.zip |
Use new ac_trie for url extraction.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/aho-corasic/acism.c | 16 | ||||
-rw-r--r-- | contrib/aho-corasic/acism.h | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/contrib/aho-corasic/acism.c b/contrib/aho-corasic/acism.c index 23a5eb334..a4c678154 100644 --- a/contrib/aho-corasic/acism.c +++ b/contrib/aho-corasic/acism.c @@ -24,11 +24,11 @@ int acism_lookup(ac_trie_t const *psp, const char *text, size_t len, - ACISM_ACTION *cb, void *context) + ACISM_ACTION *cb, void *context, int *statep) { ac_trie_t const ps = *psp; char const *cp = text, *endp = cp + len; - STATE state = 0; + STATE state = *statep; int ret = 0; while (cp < endp) { @@ -102,6 +102,18 @@ acism_lookup(ac_trie_t const *psp, const char *text, size_t len, } } EXIT: + *statep = state; return ret; } + +void +acism_destroy(ac_trie_t *psp) +{ + if (!psp) return; + if (psp->flags & IS_MMAP) + munmap((char*)psp->tranv - sizeof(ac_trie_t), + sizeof(ac_trie_t) + p_size(psp)); + else free(psp->tranv); + free(psp); +} //EOF diff --git a/contrib/aho-corasic/acism.h b/contrib/aho-corasic/acism.h index af6f60253..3886b149e 100644 --- a/contrib/aho-corasic/acism.h +++ b/contrib/aho-corasic/acism.h @@ -46,6 +46,6 @@ typedef int (ACISM_ACTION)(int strnum, int textpos, void *context); // *state should initially be (0). int acism_lookup(ac_trie_t const *psp, const char *text, size_t len, - ACISM_ACTION *cb, void *context); + ACISM_ACTION *cb, void *context, int *statep); #endif//ACISM_H |