summaryrefslogtreecommitdiffstats
path: root/osi/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'osi/src/config.c')
-rw-r--r--osi/src/config.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/osi/src/config.c b/osi/src/config.c
index 11a5baf72..c87f5310a 100644
--- a/osi/src/config.c
+++ b/osi/src/config.c
@@ -96,6 +96,30 @@ config_t *config_new(const char *filename) {
return config;
}
+config_t *config_new_clone(const config_t *src) {
+ assert(src != NULL);
+
+ config_t *ret = config_new_empty();
+
+ assert(ret != NULL);
+
+ for (const list_node_t *node = list_begin(src->sections);
+ node != list_end(src->sections);
+ node = list_next(node)) {
+ section_t *sec = list_node(node);
+
+ for (const list_node_t *node_entry = list_begin(sec->entries);
+ node_entry != list_end(sec->entries);
+ node_entry = list_next(node_entry)) {
+ entry_t *entry = list_node(node_entry);
+
+ config_set_string(ret, sec->name, entry->key, entry->value);
+ }
+ }
+
+ return ret;
+}
+
void config_free(config_t *config) {
if (!config)
return;