From 844bdb5d1d2f121bc450d3f3d687bdec9d41f772 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 15 Oct 2015 13:57:39 +0100 Subject: [PATCH] Words are now rspamd_ftok_t --- src/libmime/message.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libmime/message.c b/src/libmime/message.c index 8b257aab3..e17d159f3 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1015,7 +1015,7 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, { guint s1len, s2len, x, y, lastdiag, olddiag; guint *column; - rspamd_fstring_t *s1, *s2; + rspamd_ftok_t *s1, *s2; gint eq; static const guint max_words = 8192; @@ -1039,9 +1039,9 @@ rspamd_words_levenshtein_distance (struct rspamd_task *task, for (y = 1, lastdiag = x - 1; y <= s1len; y++) { olddiag = column[y]; - s1 = &g_array_index (w1, rspamd_fstring_t, y - 1); - s2 = &g_array_index (w2, rspamd_fstring_t, x - 1); - eq = rspamd_fstring_equal (s1, s2) ? 0 : 1; + s1 = &g_array_index (w1, rspamd_ftok_t, y - 1); + s2 = &g_array_index (w2, rspamd_ftok_t, x - 1); + eq = rspamd_ftok_cmp (s1, s2) == 0 ? 0 : 1; column[y] = MIN3 (column[y] + 1, column[y - 1] + 1, lastdiag + (eq)); lastdiag = olddiag; @@ -1724,7 +1724,7 @@ rspamd_message_parse (struct rspamd_task *task) dw = rspamd_words_levenshtein_distance (task, p1->normalized_words, p2->normalized_words); - diff = tw > 0 ? (100.0 * (gdouble)(tw - dw) / (gdouble)tw) : 100; + diff = (100.0 * (gdouble)(tw - dw) / (gdouble)tw); debug_task ( "different words: %d, total words: %d, " -- 2.39.5