diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-09-14 19:11:19 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-09-14 19:11:19 +0400 |
commit | a0f41f7c5712e73e8aa521f2064bc53be3315d0a (patch) | |
tree | 147e4d8956a5a3b85e0ecc15b9fcbe29742e4e5c /src/cfg_utils.c | |
parent | a90c7d7a12561845e3371efc6803b1ecf6ad7d89 (diff) | |
download | rspamd-a0f41f7c5712e73e8aa521f2064bc53be3315d0a.tar.gz rspamd-a0f41f7c5712e73e8aa521f2064bc53be3315d0a.zip |
* New system of classifiers interface and statfiles processing
* Fix sample config
* Fix compile warnings
* Fix building without lua support
* Fix bugs with nrcpt header parsing and symbols cache loading (by Anton Nekhoroshikh)
Diffstat (limited to 'src/cfg_utils.c')
-rw-r--r-- | src/cfg_utils.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/cfg_utils.c b/src/cfg_utils.c index 7d06e662c..0acd50be8 100644 --- a/src/cfg_utils.c +++ b/src/cfg_utils.c @@ -186,7 +186,7 @@ init_defaults (struct config_file *cfg) cfg->factors = g_hash_table_new (g_str_hash, g_str_equal); cfg->c_modules = g_hash_table_new (g_str_hash, g_str_equal); cfg->composite_symbols = g_hash_table_new (g_str_hash, g_str_equal); - cfg->statfiles = g_hash_table_new (g_str_hash, g_str_equal); + cfg->classifiers_symbols = g_hash_table_new (g_str_hash, g_str_equal); cfg->cfg_params = g_hash_table_new (g_str_hash, g_str_equal); init_settings (cfg); @@ -207,10 +207,10 @@ free_config (struct config_file *cfg) g_hash_table_unref (cfg->c_modules); g_hash_table_remove_all (cfg->composite_symbols); g_hash_table_unref (cfg->composite_symbols); - g_hash_table_remove_all (cfg->statfiles); - g_hash_table_unref (cfg->statfiles); g_hash_table_remove_all (cfg->cfg_params); g_hash_table_unref (cfg->cfg_params); + g_hash_table_destroy (cfg->classifiers_symbols); + g_list_free (cfg->classifiers); g_list_free (cfg->metrics_list); memory_pool_delete (cfg->cfg_pool); } @@ -604,6 +604,20 @@ parse_comma_list (memory_pool_t *pool, char *line) return res; } +struct classifier_config * +check_classifier_cfg (struct config_file *cfg, struct classifier_config *c) +{ + if (c == NULL) { + c = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct classifier_config)); + } + if (c->opts == NULL) { + c->opts = g_hash_table_new (g_str_hash, g_str_equal); + memory_pool_add_destructor (cfg->cfg_pool, (pool_destruct_func)g_hash_table_destroy, c->opts); + } + + return c; +} + /* * vi:ts=4 */ |