From b992657ed0e2720e20302b0ac8c210dff55950b2 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 22 Feb 2016 17:44:15 -0500 Subject: argv-array: add detach function The usual pattern for an argv array is to initialize it, push in some strings, and then clear it when done. Very occasionally, though, we must do other exotic things with the memory, like freeing the list but keeping the strings. Let's provide a detach function so that callers can make use of our API to build up the array, and then take ownership of it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- argv-array.h | 1 + 1 file changed, 1 insertion(+) (limited to 'argv-array.h') diff --git a/argv-array.h b/argv-array.h index a2fa0aa606..29056e49a1 100644 --- a/argv-array.h +++ b/argv-array.h @@ -20,5 +20,6 @@ void argv_array_pushl(struct argv_array *, ...); void argv_array_pushv(struct argv_array *, const char **); void argv_array_pop(struct argv_array *); void argv_array_clear(struct argv_array *); +const char **argv_array_detach(struct argv_array *); #endif /* ARGV_ARRAY_H */ -- cgit v1.2.3