aboutsummaryrefslogtreecommitdiffstats
path: root/src/classifiers/winnow.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-12 20:38:20 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-12 20:38:20 +0300
commit092a40dcf813accb11a0b6bb600dccea0b35fb1d (patch)
treebc15b37adda2a21575799204dbc528874d2e82c2 /src/classifiers/winnow.c
parent1ad9f1f651ef3f0ee26d69007dd27e60f99f1f12 (diff)
downloadrspamd-092a40dcf813accb11a0b6bb600dccea0b35fb1d.tar.gz
rspamd-092a40dcf813accb11a0b6bb600dccea0b35fb1d.zip
* Write revision and revision time to statfile
* Make some improvements to API (trying to make it more clear)
Diffstat (limited to 'src/classifiers/winnow.c')
-rw-r--r--src/classifiers/winnow.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c
index cc2a0cc23..8f2b6a6fb 100644
--- a/src/classifiers/winnow.c
+++ b/src/classifiers/winnow.c
@@ -154,15 +154,13 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp
}
void
-winnow_learn (struct classifier_ctx *ctx, statfile_pool_t * pool, char *symbol, GTree * input, int in_class)
+winnow_learn (struct classifier_ctx *ctx, statfile_pool_t *pool, stat_file_t *file, GTree * input, int in_class)
{
struct winnow_callback_data data = {
.file = NULL,
.sum = 0,
.count = 0,
};
- GList *cur;
- struct statfile *st;
g_assert (pool != NULL);
g_assert (ctx != NULL);
@@ -172,25 +170,7 @@ winnow_learn (struct classifier_ctx *ctx, statfile_pool_t * pool, char *symbol,
data.now = time (NULL);
data.ctx = ctx;
- cur = g_list_first (ctx->cfg->statfiles);
- while (cur) {
- st = cur->data;
- if (strcmp (symbol, st->symbol) == 0) {
- if ((data.file = statfile_pool_open (pool, st->path, st->size, FALSE)) == NULL) {
- /* Try to create statfile */
- if (statfile_pool_create (pool, st->path, st->size) == -1) {
- msg_err ("winnow_learn: cannot create statfile %s", st->path);
- return;
- }
- if ((data.file = statfile_pool_open (pool, st->path, st->size, FALSE)) == NULL) {
- msg_err ("winnow_learn: cannot create statfile %s", st->path);
- return;
- }
- }
- break;
- }
- cur = g_list_next (cur);
- }
+ data.file = file;
if (data.file != NULL) {
statfile_pool_lock_file (pool, data.file);