summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-11-25 22:52:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-26 06:15:07 (GMT)
commit7f14609e296d5737f34607d4c3e40bb1b063ef04 (patch)
tree30f74227a1ee7a7b2d5c0570a2a72dc4afaccc21 /diff.c
parent2b7098936c9e91d527aa53b8d4af0b25d7e912b4 (diff)
downloadgit-7f14609e296d5737f34607d4c3e40bb1b063ef04.zip
git-7f14609e296d5737f34607d4c3e40bb1b063ef04.tar.gz
git-7f14609e296d5737f34607d4c3e40bb1b063ef04.tar.bz2
run-command API users: use strvec_push(), not argv construction
Change a pattern of hardcoding an "argv" array size, populating it and assigning to the "argv" member of "struct child_process" to instead use "strvec_push()" to add data to the "args" member. As noted in the preceding commit this moves us further towards being able to remove the "argv" member in a subsequent commit These callers could have used strvec_pushl(), but moving to strvec_push() makes the diff easier to read, and keeps the arguments aligned as before. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/diff.c b/diff.c
index 861282d..4107685 100644
--- a/diff.c
+++ b/diff.c
@@ -6921,19 +6921,15 @@ static char *run_textconv(struct repository *r,
size_t *outsize)
{
struct diff_tempfile *temp;
- const char *argv[3];
- const char **arg = argv;
struct child_process child = CHILD_PROCESS_INIT;
struct strbuf buf = STRBUF_INIT;
int err = 0;
temp = prepare_temp_file(r, spec->path, spec);
- *arg++ = pgm;
- *arg++ = temp->name;
- *arg = NULL;
+ strvec_push(&child.args, pgm);
+ strvec_push(&child.args, temp->name);
child.use_shell = 1;
- child.argv = argv;
child.out = -1;
if (start_command(&child)) {
remove_tempfile();