From: Vsevolod Stakhov Date: Sat, 26 Oct 2013 14:37:36 +0000 (+0100) Subject: Parse all objects from ucl. X-Git-Tag: 0.6.0~103 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=88ec9619c8181be21459fb7d7774f51b74fefc96;p=rspamd.git Parse all objects from ucl. --- 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 */