diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-08-14 17:14:02 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-08-14 17:14:02 +0400 |
commit | 8b8ae0cf7aeaff5d202ebb084e67fabaeb67d055 (patch) | |
tree | 0693513f1d7c4997af1f160fbdf9137115496c01 /cfg_utils.c | |
parent | 5014f7e7cbddb7890502bdf6ee53c7be60124f60 (diff) | |
download | rspamd-8b8ae0cf7aeaff5d202ebb084e67fabaeb67d055.tar.gz rspamd-8b8ae0cf7aeaff5d202ebb084e67fabaeb67d055.zip |
* Add initial implementation of C modules API
Diffstat (limited to 'cfg_utils.c')
-rw-r--r-- | cfg_utils.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/cfg_utils.c b/cfg_utils.c index afaa6a262..78c37dabd 100644 --- a/cfg_utils.c +++ b/cfg_utils.c @@ -1,3 +1,4 @@ +#include <sys/types.h> #include <ctype.h> #include <errno.h> #include <stdarg.h> @@ -10,8 +11,8 @@ #include <syslog.h> #include <netdb.h> #include <math.h> -#include <sys/types.h> -#ifndef OWN_QUEUE_H +#include "config.h" +#ifndef HAVE_OWN_QUEUE_H #include <sys/queue.h> #else #include "queue.h" @@ -127,7 +128,8 @@ init_defaults (struct config_file *cfg) cfg->workers_number = DEFAULT_WORKERS_NUM; LIST_INIT (&cfg->filters); - LIST_INIT (&cfg->modules); + LIST_INIT (&cfg->perl_modules); + LIST_INIT (&cfg->c_modules); } void @@ -136,6 +138,7 @@ free_config (struct config_file *cfg) struct filter_chain *chain, *tmp_chain; struct script_param *param, *tmp_param; struct perl_module *module, *tmp_module; + struct c_module *cmodule, *tmp_cmodule; if (cfg->pid_file) { g_free (cfg->pid_file); @@ -150,10 +153,10 @@ free_config (struct config_file *cfg) LIST_FOREACH_SAFE (chain, &cfg->filters, next, tmp_chain) { LIST_FOREACH_SAFE (param, chain->scripts, next, tmp_param) { if (param->symbol) { - g_free (param->symbol); + free (param->symbol); } if (param->function) { - g_free (param->function); + free (param->function); } LIST_REMOVE (param, next); free (param); @@ -161,14 +164,20 @@ free_config (struct config_file *cfg) LIST_REMOVE (chain, next); free (chain); } - LIST_FOREACH_SAFE (module, &cfg->modules, next, tmp_module) { + LIST_FOREACH_SAFE (module, &cfg->perl_modules, next, tmp_module) { if (module->path) { - g_free (module->path); + free (module->path); } LIST_REMOVE (module, next); free (module); } + LIST_FOREACH_SAFE (cmodule, &cfg->c_modules, next, tmp_cmodule) { + if (cmodule->ctx) { + free (cmodule->ctx); + } + free (cmodule); + } } int |