Skip to contentSkip to conversation

master - config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed

PATCH Zdenek Kabelac 1 participant 1 message Sep 21, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=045772aa30ba1c5ab9dff730ce25ca6346c7150a
Commit:        045772aa30ba1c5ab9dff730ce25ca6346c7150a
Parent:        e40fbd08c8e3da43d07aabe58bd5549105056908
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Wed Sep 21 14:42:16 2016 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Sep 21 18:18:15 2016 +0200

config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed

---
 libdaemon/client/config-util.c |   15 +++++++++++++++
 libdaemon/client/config-util.h |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)
libdaemon/client/config-util.c +15 -0
index e262182..93f3d0a 100644
@@ -161,6 +161,21 @@ void chain_node(struct dm_config_node *cn,
 
 }
 
+struct dm_config_tree *config_tree_from_string_without_dup_node_check(const char *config_settings)
+{
+	struct dm_config_tree *cft;
+
+	if (!(cft = dm_config_create()))
+		return_NULL;
+
+	if (!dm_config_parse_without_dup_node_check(cft, config_settings, config_settings + strlen(config_settings))) {
+		dm_config_destroy(cft);
+		return_NULL;
+	}
+
+	return cft;
+}
+
 struct dm_config_node *make_config_node(struct dm_config_tree *cft,
 					const char *key,
 					struct dm_config_node *parent,
libdaemon/client/config-util.h +2 -0
index 38f36af..485161f 100644
@@ -66,4 +66,6 @@ struct dm_config_node *config_make_nodes(struct dm_config_tree *cft,
 					 struct dm_config_node *pre_sib,
 					 ...);
 
+struct dm_config_tree *config_tree_from_string_without_dup_node_check(const char *config_settings);
+
 #endif /* _LVM_DAEMON_CONFIG_UTIL_H */