diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-09-02 19:42:58 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-09-02 19:42:58 +0400 |
commit | 2809ad4747b7e3a3795aec4e433d7754c7efc365 (patch) | |
tree | 924e32c2c66062b6b9b7e3525ada783b092aaea8 /cfg_utils.c | |
parent | bacc29586271996154884ff8c531520385318a84 (diff) | |
download | rspamd-2809ad4747b7e3a3795aec4e433d7754c7efc365.tar.gz rspamd-2809ad4747b7e3a3795aec4e433d7754c7efc365.zip |
* Add ability to pass options to rspamd modules via flex start conditions
Diffstat (limited to 'cfg_utils.c')
-rw-r--r-- | cfg_utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cfg_utils.c b/cfg_utils.c index 78c37dabd..83738aea6 100644 --- a/cfg_utils.c +++ b/cfg_utils.c @@ -24,6 +24,24 @@ extern int yylineno; extern char *yytext; +static void +clean_hash_bucket (gpointer key, gpointer value, gpointer unused) +{ + LIST_HEAD (moduleoptq, module_opt) *cur_module_opt = (struct moduleoptq *)value; + struct module_opt *cur, *tmp; + + LIST_FOREACH_SAFE (cur, cur_module_opt, next, tmp) { + if (cur->param) { + free (cur->param); + } + if (cur->value) { + free (cur->value); + } + LIST_REMOVE (cur, next); + free (cur); + } +} + int add_memcached_server (struct config_file *cf, char *str) { @@ -126,6 +144,7 @@ init_defaults (struct config_file *cfg) cfg->memcached_protocol = TCP_TEXT; cfg->workers_number = DEFAULT_WORKERS_NUM; + cfg->modules_opts = g_hash_table_new (g_str_hash, g_str_equal); LIST_INIT (&cfg->filters); LIST_INIT (&cfg->perl_modules); @@ -178,6 +197,10 @@ free_config (struct config_file *cfg) } free (cmodule); } + + g_hash_table_foreach (cfg->modules_opts, clean_hash_bucket, NULL); + g_hash_table_remove_all (cfg->modules_opts); + g_hash_table_unref (cfg->modules_opts); } int |