From 88ec9619c8181be21459fb7d7774f51b74fefc96 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 26 Oct 2013 15:37:36 +0100 Subject: [PATCH] Parse all objects from ucl. --- src/cfg_rcl.c | 10 ++++++---- src/filter.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c index 34999f66a..a993a4ace 100644 --- a/src/cfg_rcl.c +++ b/src/cfg_rcl.c @@ -420,7 +420,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj, } /* Insert the resulting metric */ - g_hash_table_insert (cfg->metrics, metric->name, metric); + g_hash_table_insert (cfg->metrics, (void *)metric->name, metric); cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric); return TRUE; @@ -694,7 +694,7 @@ gboolean rspamd_read_rcl_config (struct rspamd_rcl_section *top, struct config_file *cfg, ucl_object_t *obj, GError **err) { - ucl_object_t *found; + ucl_object_t *found, *cur_obj; struct rspamd_rcl_section *cur, *tmp; if (obj->type != UCL_OBJECT) { @@ -719,8 +719,10 @@ rspamd_read_rcl_config (struct rspamd_rcl_section *top, return FALSE; } } - if (!cur->handler (cfg, found, NULL, cur, err)) { - return FALSE; + LL_FOREACH (found, cur_obj) { + if (!cur->handler (cfg, cur_obj, NULL, cur, err)) { + return FALSE; + } } } } diff --git a/src/filter.h b/src/filter.h index 7843775ac..79fae6449 100644 --- a/src/filter.h +++ b/src/filter.h @@ -55,7 +55,7 @@ struct metric_action { * Common definition of metric */ struct metric { - gchar *name; /**< name of metric */ + const gchar *name; /**< name of metric */ gchar *func_name; /**< name of consolidation function */ metric_cons_func func; /**< c consolidation function */ double grow_factor; /**< grow factor for metric */ -- 2.39.5