aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-02-22 17:44:15 -0500
committerJunio C Hamano <gitster@pobox.com>2016-02-22 14:50:32 -0800
commitb992657ed0e2720e20302b0ac8c210dff55950b2 (patch)
treeda139d348ebf30385b1ff8ea758ba8befe0b44b1 /Documentation
parent3689539127f786f32ff04da374d37cc1f72fb918 (diff)
downloadgit-b992657ed0e2720e20302b0ac8c210dff55950b2.tar.gz
git-b992657ed0e2720e20302b0ac8c210dff55950b2.tar.xz
argv-array: add detach function
The usual pattern for an argv array is to initialize it, push in some strings, and then clear it when done. Very occasionally, though, we must do other exotic things with the memory, like freeing the list but keeping the strings. Let's provide a detach function so that callers can make use of our API to build up the array, and then take ownership of it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/technical/api-argv-array.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/technical/api-argv-array.txt b/Documentation/technical/api-argv-array.txt
index 8076172a0..cfc063018 100644
--- a/Documentation/technical/api-argv-array.txt
+++ b/Documentation/technical/api-argv-array.txt
@@ -56,3 +56,10 @@ Functions
`argv_array_clear`::
Free all memory associated with the array and return it to the
initial, empty state.
+
+`argv_array_detach`::
+ Disconnect the `argv` member from the `argv_array` struct and
+ return it. The caller is responsible for freeing the memory used
+ by the array, and by the strings it references. After detaching,
+ the `argv_array` is in a reinitialized state and can be pushed
+ into again.