diff options
-rw-r--r-- | src/libstat/backends/backends.h | 3 | ||||
-rw-r--r-- | src/libstat/stat_config.c | 14 | ||||
-rw-r--r-- | src/libstat/stat_internal.h | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/libstat/backends/backends.h b/src/libstat/backends/backends.h index 800030414..da04ebbb8 100644 --- a/src/libstat/backends/backends.h +++ b/src/libstat/backends/backends.h @@ -36,8 +36,7 @@ struct rspamd_statfile_config; struct rspamd_config; struct rspamd_stat_ctx; struct rspamd_token_result; -struct rspamd_statfile_runtime; -struct token_node_s; +struct rspamd_statfile; struct rspamd_task; struct rspamd_stat_backend { diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index baf757ac7..647079367 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -57,9 +57,9 @@ static struct rspamd_stat_tokenizer stat_tokenizers[] = { .name = #nam, \ .init = rspamd_##eltn##_init, \ .runtime = rspamd_##eltn##_runtime, \ - .process_token = rspamd_##eltn##_process_token, \ + .process_tokens = rspamd_##eltn##_process_tokens, \ .finalize_process = rspamd_##eltn##_finalize_process, \ - .learn_token = rspamd_##eltn##_learn_token, \ + .learn_tokens = rspamd_##eltn##_learn_tokens, \ .finalize_learn = rspamd_##eltn##_finalize_learn, \ .total_learns = rspamd_##eltn##_total_learns, \ .inc_learns = rspamd_##eltn##_inc_learns, \ @@ -86,7 +86,6 @@ static struct rspamd_stat_cache stat_caches[] = { void rspamd_stat_init (struct rspamd_config *cfg) { - guint i; GList *cur, *curst; struct rspamd_classifier_config *clf; struct rspamd_statfile_config *stf; @@ -126,7 +125,7 @@ rspamd_stat_init (struct rspamd_config *cfg) * We NO LONGER support multiple tokenizers per rspamd instance */ if (stat_ctx->tkcf == NULL) { - stat_ctx->tokenizer = rspamd_stat_get_tokenizer (clf->tokenizer); + stat_ctx->tokenizer = rspamd_stat_get_tokenizer (clf->tokenizer->name); g_assert (stat_ctx->tokenizer != NULL); stat_ctx->tkcf = stat_ctx->tokenizer->get_config (cfg->cfg_pool, clf->tokenizer, NULL); @@ -160,9 +159,10 @@ rspamd_stat_init (struct rspamd_config *cfg) st = g_slice_alloc0 (sizeof (*st)); st->classifier = cl; st->stcf = stf; - st->bkcf = stat_ctx->backends_subrs[i].init (stat_ctx, cfg, st); - msg_debug_config ("added backend %s", - stat_ctx->backends_subrs[i].name); + st->backend = bk; + st->bkcf = bk->init (stat_ctx, cfg, st); + msg_debug_config ("added backend %s for symbol %s", + bk->name, stf->symbol); if (st->bkcf == NULL) { msg_err_config ("cannot init backend %s for statfile %s", diff --git a/src/libstat/stat_internal.h b/src/libstat/stat_internal.h index 2dd3f2fb5..09fd87fb6 100644 --- a/src/libstat/stat_internal.h +++ b/src/libstat/stat_internal.h @@ -81,7 +81,7 @@ typedef struct token_node_s { guchar data[RSPAMD_MAX_TOKEN_LEN]; guint window_idx; guint datalen; - gdouble values[0]; + gdouble values[]; } rspamd_token_t; struct rspamd_stat_ctx { |