Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ff857e4

Browse files
peffgitster
authored andcommitted
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>
1 parent 173fd1a commit ff857e4

File tree

3 files changed

+0
-30
lines changed

3 files changed

+0
-30
lines changed

Documentation/technical/api-argv-array.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,3 @@ Functions
5353
`argv_array_clear`::
5454
Free all memory associated with the array and return it to the
5555
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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,3 @@ void argv_array_clear(struct argv_array *array)
6868
}
6969
argv_array_init(array);
7070
}
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@ LAST_ARG_MUST_BE_NULL
1919
void argv_array_pushl(struct argv_array *, ...);
2020
void argv_array_pop(struct argv_array *);
2121
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);
2422

2523
#endif /* ARGV_ARRAY_H */

0 commit comments

Comments
 (0)