summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'common.c')
-rw-r--r--common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common.c b/common.c
index 629b31b..1ec8cee 100644
--- a/common.c
+++ b/common.c
@@ -1385,6 +1385,20 @@ end:
return object;
}
+/// Clone an item. Schema assignments aren't retained.
+struct config_item_ *
+config_item_clone (struct config_item_ *self)
+{
+ // Oh well, it saves code
+ struct str tmp;
+ str_init (&tmp);
+ config_item_write (self, false, &tmp);
+ struct config_item_ *result =
+ config_item_parse (tmp.str, tmp.len, true, NULL);
+ str_free (&tmp);
+ return result;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// XXX: this thing is ugly in concept