diff mbox series

[v5,08/10] strvec: expose strvec_push_nodup for external use

Message ID 65a620b08ef359e29d678497f1b529e3ce6477b1.1673475190.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Enhance credential helper protocol to include auth headers | expand

Commit Message

Matthew John Cheetham Jan. 11, 2023, 10:13 p.m. UTC
From: Matthew John Cheetham <mjcheetham@outlook.com>

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@outlook.com>
---
 strvec.c | 2 +-
 strvec.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 *);