Commit ff857e4e authored by Jeff King's avatar Jeff King Committed by Junio C Hamano

argv-array: drop "detach" code

The argv_array_detach function (and associated free() function) was
really only useful for transferring ownership of the memory to a "struct
child_process". Now that we have an internal argv_array in that struct,
there are no callers left.
Signed-off-by: default avatarJeff King <>
Signed-off-by: default avatarJunio C Hamano <>
parent 173fd1a1
......@@ -53,11 +53,3 @@ Functions
Free all memory associated with the array and return it to the
initial, empty state.
Detach the argv array from the `struct argv_array`, transferring
ownership of the allocated array and strings.
Free the memory allocated by a `struct argv_array` that was later
detached and is now no longer needed.
......@@ -68,23 +68,3 @@ void argv_array_clear(struct argv_array *array)
const char **argv_array_detach(struct argv_array *array, int *argc)
const char **argv =
array->argv == empty_argv || array->argc == 0 ? NULL : array->argv;
if (argc)
*argc = array->argc;
return argv;
void argv_array_free_detached(const char **argv)
if (argv) {
int i;
for (i = 0; argv[i]; i++)
free((char **)argv[i]);
......@@ -19,7 +19,5 @@ LAST_ARG_MUST_BE_NULL
void argv_array_pushl(struct argv_array *, ...);
void argv_array_pop(struct argv_array *);
void argv_array_clear(struct argv_array *);
const char **argv_array_detach(struct argv_array *array, int *argc);
void argv_array_free_detached(const char **argv);
#endif /* ARGV_ARRAY_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment