diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-23 12:18:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-23 12:18:04 +0000 |
commit | 8f5509c65dc6907a7581518246a200236088423c (patch) | |
tree | 448c0233a83ee25855999033c22d78b2297b64f5 /src/libstat/tokenizers | |
parent | 8969605e58c22b95ac4eb8783b6c4d045732810e (diff) | |
download | rspamd-8f5509c65dc6907a7581518246a200236088423c.tar.gz rspamd-8f5509c65dc6907a7581518246a200236088423c.zip |
Rework statistics runtime structures.
Diffstat (limited to 'src/libstat/tokenizers')
-rw-r--r-- | src/libstat/tokenizers/osb.c | 9 | ||||
-rw-r--r-- | src/libstat/tokenizers/tokenizers.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/libstat/tokenizers/osb.c b/src/libstat/tokenizers/osb.c index 4016842b6..abf547f43 100644 --- a/src/libstat/tokenizers/osb.c +++ b/src/libstat/tokenizers/osb.c @@ -29,6 +29,9 @@ #include <sys/types.h> #include "tokenizers.h" +/* Size for features pipe */ +#define FEATURE_WINDOW_SIZE 5 + /* Minimum length of token */ #define MIN_LEN 4 @@ -43,7 +46,7 @@ osb_tokenize_text (struct tokenizer *tokenizer, gboolean is_utf, GList *exceptions) { - token_node_t *new = NULL; + rspamd_token_t *new = NULL; rspamd_fstring_t *token; guint32 hashpipe[FEATURE_WINDOW_SIZE], h1, h2; gint i, processed = 0; @@ -82,7 +85,7 @@ osb_tokenize_text (struct tokenizer *tokenizer, h1 = hashpipe[0] * primes[0] + hashpipe[i] * primes[i << 1]; h2 = hashpipe[0] * primes[1] + hashpipe[i] * primes[(i << 1) - 1]; - new = rspamd_mempool_alloc0 (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc0 (pool, sizeof (rspamd_token_t)); new->datalen = sizeof(gint32) * 2; memcpy(new->data, &h1, sizeof(h1)); memcpy(new->data + sizeof(h1), &h2, sizeof(h2)); @@ -98,7 +101,7 @@ osb_tokenize_text (struct tokenizer *tokenizer, for (i = 1; i < processed; i++) { h1 = hashpipe[0] * primes[0] + hashpipe[i] * primes[i << 1]; h2 = hashpipe[0] * primes[1] + hashpipe[i] * primes[(i << 1) - 1]; - new = rspamd_mempool_alloc0 (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc0 (pool, sizeof (rspamd_token_t)); new->datalen = sizeof(gint32) * 2; memcpy(new->data, &h1, sizeof(h1)); memcpy(new->data + sizeof(h1), &h2, sizeof(h2)); diff --git a/src/libstat/tokenizers/tokenizers.c b/src/libstat/tokenizers/tokenizers.c index 7d00f693a..10e4b92d5 100644 --- a/src/libstat/tokenizers/tokenizers.c +++ b/src/libstat/tokenizers/tokenizers.c @@ -92,7 +92,7 @@ rspamd_stat_get_tokenizer (const char *name) int token_node_compare_func (gconstpointer a, gconstpointer b) { - const token_node_t *aa = a, *bb = b; + const rspamd_token_t *aa = a, *bb = b; if (aa->datalen != bb->datalen) { return aa->datalen - bb->datalen; |