summaryrefslogtreecommitdiff
path: root/argv-array.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:29 (GMT)
commite47dbece39712567a36a096010c5c1223119f7e3 (patch)
treeaced74e797a0c37931e367574bdd60cbfb63e0f4 /argv-array.c
parent9472b13201aea57d7f9212ca2678aba4d6dbdfdb (diff)
parent1c41d2805e42d77d943fd3d79ebf5136f74c9ba3 (diff)
downloadgit-e47dbece39712567a36a096010c5c1223119f7e3.zip
git-e47dbece39712567a36a096010c5c1223119f7e3.tar.gz
git-e47dbece39712567a36a096010c5c1223119f7e3.tar.bz2
Merge branch 'ma/unpack-trees-free-msgs'
Leak plugging. * ma/unpack-trees-free-msgs: unpack_trees_options: free messages when done argv-array: return the pushed string from argv_push*() merge-recursive: provide pair of `unpack_trees_{start,finish}()` merge: setup `opts` later in `checkout_fast_forward()`
Diffstat (limited to 'argv-array.c')
-rw-r--r--argv-array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/argv-array.c b/argv-array.c
index cb5bcd2..f352ea9 100644
--- a/argv-array.c
+++ b/argv-array.c
@@ -21,12 +21,13 @@ static void argv_array_push_nodup(struct argv_array *array, const char *value)
array->argv[array->argc] = NULL;
}
-void argv_array_push(struct argv_array *array, const char *value)
+const char *argv_array_push(struct argv_array *array, const char *value)
{
argv_array_push_nodup(array, xstrdup(value));
+ return array->argv[array->argc - 1];
}
-void argv_array_pushf(struct argv_array *array, const char *fmt, ...)
+const char *argv_array_pushf(struct argv_array *array, const char *fmt, ...)
{
va_list ap;
struct strbuf v = STRBUF_INIT;
@@ -36,6 +37,7 @@ void argv_array_pushf(struct argv_array *array, const char *fmt, ...)
va_end(ap);
argv_array_push_nodup(array, strbuf_detach(&v, NULL));
+ return array->argv[array->argc - 1];
}
void argv_array_pushl(struct argv_array *array, ...)