summaryrefslogtreecommitdiff
path: root/argv-array.c
diff options
context:
space:
mode:
Diffstat (limited to 'argv-array.c')
-rw-r--r--argv-array.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/argv-array.c b/argv-array.c
index eaed47712b..5d370fa336 100644
--- a/argv-array.c
+++ b/argv-array.c
@@ -74,3 +74,14 @@ void argv_array_clear(struct argv_array *array)
}
argv_array_init(array);
}
+
+const char **argv_array_detach(struct argv_array *array)
+{
+ if (array->argv == empty_argv)
+ return xcalloc(1, sizeof(const char *));
+ else {
+ const char **ret = array->argv;
+ argv_array_init(array);
+ return ret;
+ }
+}