summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slv2/value.h6
-rw-r--r--src/value.c11
2 files changed, 17 insertions, 0 deletions
diff --git a/slv2/value.h b/slv2/value.h
index c61acf4..1470d36 100644
--- a/slv2/value.h
+++ b/slv2/value.h
@@ -37,6 +37,12 @@ void
slv2_value_free(SLV2Value val);
+/** Duplicate an SLV2Value.
+ */
+SLV2Value
+slv2_value_duplicate(SLV2Value val);
+
+
/** Return whether two values are equivalent.
*/
bool
diff --git a/src/value.c b/src/value.c
index 331c20c..f4dc673 100644
--- a/src/value.c
+++ b/src/value.c
@@ -50,6 +50,17 @@ slv2_value_new(SLV2ValueType type, const char* str)
}
+SLV2Value
+slv2_value_duplicate(SLV2Value val)
+{
+ SLV2Value result = (SLV2Value)malloc(sizeof(struct _SLV2Value));
+ result->str_val = strdup(val->str_val);
+ result->type = val->type;
+ result->val = val->val;
+ return result;
+}
+
+
void
slv2_value_free(SLV2Value val)
{