From df6562305f81d4d737a0aedf9f1560375daf8d39 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 27 Apr 2009 13:42:41 +0400 Subject: [PATCH] * Skip identical parts while testing mime regexps --- src/plugins/regexp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 6693d5782..e1f751ef9 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -203,7 +203,7 @@ static gsize process_regexp (struct rspamd_regexp *re, struct worker_task *task) { char *headerv, *c, t; - struct mime_text_part *part; + struct mime_text_part *part, *tmp; GList *cur, *headerlist; GRegex *regexp; struct uri *url; @@ -271,7 +271,16 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task) task_cache_add (task, re, 1); return 1; } - cur = g_list_next (cur); + /* Skip identical parts */ + while (cur) { + cur = g_list_next (cur); + if (cur) { + tmp = (struct mime_text_part *)cur->data; + if (fuzzy_compare_hashes (tmp->fuzzy, part->fuzzy) > 70) { + break; + } + } + } } task_cache_add (task, re, 0); return 0; -- 2.39.5