From: Vsevolod Stakhov Date: Thu, 27 May 2010 15:16:13 +0000 (+0400) Subject: * In classify normalize result after comparing, not before X-Git-Tag: 0.3.1~123 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7df6149f7f66c2d76a41f15fc7d6a6b988e8a696;p=rspamd.git * In classify normalize result after comparing, not before --- diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c index 1d48cc2ba..78e05d43b 100644 --- a/src/classifiers/winnow.c +++ b/src/classifiers/winnow.c @@ -232,9 +232,6 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp if (data.count != 0) { res = data.sum / data.count; - if (st->normalizer != NULL) { - res = st->normalizer (task->cfg, res, st->normalizer_data); - } } else { res = 0; @@ -253,6 +250,9 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp #ifdef WITH_LUA max = call_classifier_post_callbacks (ctx->cfg, task, max); #endif + if (st->normalizer != NULL) { + max = st->normalizer (task->cfg, max, st->normalizer_data); + } insert_result (task, ctx->cfg->metric, sel->symbol, max, cur); } } diff --git a/src/statfile.c b/src/statfile.c index 1e47b3ec7..005ea7c8a 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -365,7 +365,7 @@ statfile_pool_open (statfile_pool_t * pool, char *filename, size_t size, gboolea qsort (pool->files, pool->opened, sizeof (stat_file_t), cmpstatfile); memory_pool_unlock_mutex (pool->lock); - return new_file; + return statfile_pool_is_open (pool, filename); } int