]> git.ipfire.org Git - thirdparty/git.git/commitdiff
argv-array: drop "detach" code
authorJeff King <peff@peff.net>
Thu, 15 May 2014 08:41:03 +0000 (04:41 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 May 2014 16:49:12 +0000 (09:49 -0700)
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>
Documentation/technical/api-argv-array.txt
argv-array.c
argv-array.h

index a6b7d83a8eb05086cb88a9168117aa54cf018551..1a797812fb426189b03a814498dd7019c96607b4 100644 (file)
@@ -53,11 +53,3 @@ 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`, transferring
-       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.
index 9e960d549c158a4c761942bb17824c1d5e075d49..256741d2262b237c56b6730bea9d52c9b39b7ee3 100644 (file)
@@ -68,23 +68,3 @@ void argv_array_clear(struct argv_array *array)
        }
        argv_array_init(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;
-       argv_array_init(array);
-       return argv;
-}
-
-void argv_array_free_detached(const char **argv)
-{
-       if (argv) {
-               int i;
-               for (i = 0; argv[i]; i++)
-                       free((char **)argv[i]);
-               free(argv);
-       }
-}
index 85ba438ac1e877fa865e5b4d2301733735fa5d03..c65e6e825a96efca6111184e5c50d2406064631f 100644 (file)
@@ -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 */