Add argv_array_detach and argv_array_free_detached

Allow detaching of ownership of the argv_array's contents and add a
function to free those detached argv_arrays later.

This makes it possible to use argv_array efficiently with the exiting
struct child_process which only contains a member char **argv.

Add to documentation.

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
Acked-by: David Michael Barr <b@rr-dav.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Florian Achleitner
2012-09-19 17:21:18 +02:00
committed by Junio C Hamano
parent fd871b94f6
commit df7428eca4
3 changed files with 30 additions and 0 deletions

View File

@ -49,3 +49,11 @@ Functions
`argv_array_clear`::
Free all memory associated with the array and return it to the
initial, empty state.
`argv_array_detach`::
Detach the argv array from the `struct argv_array`, transfering
ownership of the allocated array and strings.
`argv_array_free_detached`::
Free the memory allocated by a `struct argv_array` that was later
detached and is now no longer needed.