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: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 15, 2014 at 04:41 UTC ff857e4ee8680af3988aff3383b1158f396a6fb2
3 files changed -30
Documentation/technical/api-argv-array.txt
-8
@@ -53,11 +53,3 @@ Functions
53 `argv_array_clear`::
54 Free all memory associated with the array and return it to the
55 initial, empty state.
56 -
57 -`argv_array_detach`::
58 - Detach the argv array from the `struct argv_array`, transferring
59 - ownership of the allocated array and strings.
60 -
61 -`argv_array_free_detached`::
62 - Free the memory allocated by a `struct argv_array` that was later
63 - detached and is now no longer needed.
argv-array.c
-20
@@ -68,23 +68,3 @@ void argv_array_clear(struct argv_array *array)
68 }
69 argv_array_init(array);
70 }
71 -
72 -const char **argv_array_detach(struct argv_array *array, int *argc)
73 -{
74 - const char **argv =
75 - array->argv == empty_argv || array->argc == 0 ? NULL : array->argv;
76 - if (argc)
77 - *argc = array->argc;
78 - argv_array_init(array);
79 - return argv;
80 -}
81 -
82 -void argv_array_free_detached(const char **argv)
83 -{
84 - if (argv) {
85 - int i;
86 - for (i = 0; argv[i]; i++)
87 - free((char **)argv[i]);
88 - free(argv);
89 - }
90 -}
argv-array.h
-2
@@ -19,7 +19,5 @@ LAST_ARG_MUST_BE_NULL
19 void argv_array_pushl(struct argv_array *, ...);
20 void argv_array_pop(struct argv_array *);
21 void argv_array_clear(struct argv_array *);
22 -const char **argv_array_detach(struct argv_array *array, int *argc);
23 -void argv_array_free_detached(const char **argv);
22
23 #endif /* ARGV_ARRAY_H */