aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-17 13:28:26 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-17 14:57:16 +0000
commit2040127be17782c44a6c31ad2d5bcad54d919503 (patch)
tree8f996ae435544d2c6d258715b039f27a401d2ece /src/libserver
parentb80f8562f8efc3762f7e4c5ab1d65b2e3b209fd0 (diff)
downloadrspamd-2040127be17782c44a6c31ad2d5bcad54d919503.tar.gz
rspamd-2040127be17782c44a6c31ad2d5bcad54d919503.zip
Save comments from configuration files
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_file.h1
-rw-r--r--src/libserver/cfg_rcl.c3
-rw-r--r--src/libserver/cfg_utils.c1
3 files changed, 4 insertions, 1 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 8fb0075bc..373daf744 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -282,6 +282,7 @@ struct rspamd_config {
GList *workers; /**< linked list of all workers params */
GHashTable *wrk_parsers; /**< hash for worker config parsers, indexed by worker quarks */
ucl_object_t *rcl_obj; /**< rcl object */
+ ucl_object_t *config_comments; /**< comments saved from the config */
ucl_object_t *doc_strings; /**< documentation strings for config options */
GHashTable * metrics; /**< hash of metrics indexed by metric name */
GList * metrics_list; /**< linked list of metrics */
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 7a6ea429d..7b6d1180a 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -2908,7 +2908,7 @@ rspamd_config_read (struct rspamd_config *cfg, const gchar *filename,
rspamd_strlcpy (cfg->cfg_pool->tag.uid, cfg->checksum,
MIN (sizeof (cfg->cfg_pool->tag.uid), strlen (cfg->checksum)));
- parser = ucl_parser_new (0);
+ parser = ucl_parser_new (UCL_PARSER_SAVE_COMMENTS);
rspamd_ucl_add_conf_variables (parser, vars);
rspamd_ucl_add_conf_macros (parser, cfg);
@@ -2921,6 +2921,7 @@ rspamd_config_read (struct rspamd_config *cfg, const gchar *filename,
munmap (data, st.st_size);
cfg->rcl_obj = ucl_parser_get_object (parser);
+ cfg->config_comments = ucl_object_ref (ucl_parser_get_comments (parser));
ucl_parser_free (parser);
top = rspamd_rcl_config_init (cfg);
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 3e1e0d84e..a857571c4 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -171,6 +171,7 @@ rspamd_config_free (struct rspamd_config *cfg)
rspamd_map_remove_all (cfg);
ucl_object_unref (cfg->rcl_obj);
+ ucl_object_unref (cfg->config_comments);
ucl_object_unref (cfg->doc_strings);
g_hash_table_remove_all (cfg->metrics);
g_hash_table_unref (cfg->metrics);