summaryrefslogtreecommitdiffstats
path: root/src/filter.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-26 15:32:44 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-26 15:32:44 +0400
commit33f9a2a6f1c799f3f51c065485dfa1761053e88b (patch)
treecc9d5f5b3a17ab68424024a6fcfb77aa008dd0bd /src/filter.c
parentdd14cd445a856de79541512ed27a1161a159afac (diff)
downloadrspamd-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.c22
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++;
}
}