diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-26 15:32:44 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-26 15:32:44 +0400 |
commit | 33f9a2a6f1c799f3f51c065485dfa1761053e88b (patch) | |
tree | cc9d5f5b3a17ab68424024a6fcfb77aa008dd0bd /src/filter.c | |
parent | dd14cd445a856de79541512ed27a1161a159afac (diff) | |
download | rspamd-33f9a2a6f1c799f3f51c065485dfa1761053e88b.tar.gz rspamd-33f9a2a6f1c799f3f51c065485dfa1761053e88b.zip |
Fix very bad bug in a memory pool allocator.
Speed up inserting symbols by hashing them.
Diffstat (limited to 'src/filter.c')
-rw-r--r-- | src/filter.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/filter.c b/src/filter.c index b9733076c..4bf5a5637 100644 --- a/src/filter.c +++ b/src/filter.c @@ -163,25 +163,9 @@ insert_result_common (struct worker_task *task, const gchar *symbol, double flag /* Process cache item */ if (task->cfg->cache) { - cur = task->cfg->cache->static_items; - while (cur) - { - item = cur->data; - - if (strcmp (item->s->symbol, symbol) == 0) { - item->s->frequency++; - } - cur = g_list_next (cur); - } - cur = task->cfg->cache->negative_items; - while (cur) - { - item = cur->data; - - if (strcmp (item->s->symbol, symbol) == 0) { - item->s->frequency++; - } - cur = g_list_next (cur); + item = g_hash_table_lookup (task->cfg->cache->items_by_symbol, symbol); + if (item != NULL) { + item->s->frequency++; } } |