From: Matthew John Cheetham <mjcheetham@xxxxxxxxxxx> Remove the static modifier from the existing `strvec_push_nodup` function and define the function is `strvec.h` to make it available for other callers, making it now possible to append to a `struct strvec` array without duplication. Signed-off-by: Matthew John Cheetham <mjcheetham@xxxxxxxxxxx> --- strvec.c | 2 +- strvec.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/strvec.c b/strvec.c index 61a76ce6cb9..26e8751cae0 100644 --- a/strvec.c +++ b/strvec.c @@ -10,7 +10,7 @@ void strvec_init(struct strvec *array) memcpy(array, &blank, sizeof(*array)); } -static void strvec_push_nodup(struct strvec *array, const char *value) +void strvec_push_nodup(struct strvec *array, const char *value) { if (array->v == empty_strvec) array->v = NULL; diff --git a/strvec.h b/strvec.h index 9f55c8766ba..5d61dd73680 100644 --- a/strvec.h +++ b/strvec.h @@ -43,6 +43,9 @@ struct strvec { */ void strvec_init(struct strvec *); +/* Push a string onto the end of the array without copying. */ +void strvec_push_nodup(struct strvec *array, const char *value); + /* Push a copy of a string onto the end of the array. */ const char *strvec_push(struct strvec *, const char *); -- gitgitgadget