From ef8d7ac42a6a62d678166fe25ea743315809d2bb Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 16:24:53 -0400 Subject: strvec: convert more callers away from argv_array name We eventually want to drop the argv_array name and just use strvec consistently. There's no particular reason we have to do it all at once, or care about interactions between converted and unconverted bits. Because of our preprocessor compat layer, the names are interchangeable to the compiler (so even a definition and declaration using different names is OK). This patch converts remaining files from the first half of the alphabet, to keep the diff to a manageable size. The conversion was done purely mechanically with: git ls-files '*.c' '*.h' | xargs perl -i -pe ' s/ARGV_ARRAY/STRVEC/g; s/argv_array/strvec/g; ' and then selectively staging files with "git add '[abcdefghjkl]*'". We'll deal with any indentation/style fallouts separately. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- compat/mingw.c | 4 ++-- compat/terminal.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'compat') diff --git a/compat/mingw.c b/compat/mingw.c index 8ee0b6408e..4454b3e67b 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -18,8 +18,8 @@ void open_in_gdb(void) static struct child_process cp = CHILD_PROCESS_INIT; extern char *_pgmptr; - argv_array_pushl(&cp.args, "mintty", "gdb", NULL); - argv_array_pushf(&cp.args, "--pid=%d", getpid()); + strvec_pushl(&cp.args, "mintty", "gdb", NULL); + strvec_pushf(&cp.args, "--pid=%d", getpid()); cp.clean_on_exit = 1; if (start_command(&cp) < 0) die_errno("Could not start gdb"); diff --git a/compat/terminal.c b/compat/terminal.c index 35bca03d14..43b73ddc75 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -86,9 +86,9 @@ static void restore_term(void) if (stty_restore.nr == 0) return; - argv_array_push(&cp.args, "stty"); + strvec_push(&cp.args, "stty"); for (i = 0; i < stty_restore.nr; i++) - argv_array_push(&cp.args, stty_restore.items[i].string); + strvec_push(&cp.args, stty_restore.items[i].string); run_command(&cp); string_list_clear(&stty_restore, 0); return; @@ -107,25 +107,25 @@ static int disable_bits(DWORD bits) if (use_stty) { struct child_process cp = CHILD_PROCESS_INIT; - argv_array_push(&cp.args, "stty"); + strvec_push(&cp.args, "stty"); if (bits & ENABLE_LINE_INPUT) { string_list_append(&stty_restore, "icanon"); - argv_array_push(&cp.args, "-icanon"); + strvec_push(&cp.args, "-icanon"); } if (bits & ENABLE_ECHO_INPUT) { string_list_append(&stty_restore, "echo"); - argv_array_push(&cp.args, "-echo"); + strvec_push(&cp.args, "-echo"); } if (bits & ENABLE_PROCESSED_INPUT) { string_list_append(&stty_restore, "-ignbrk"); string_list_append(&stty_restore, "intr"); string_list_append(&stty_restore, "^c"); - argv_array_push(&cp.args, "ignbrk"); - argv_array_push(&cp.args, "intr"); - argv_array_push(&cp.args, ""); + strvec_push(&cp.args, "ignbrk"); + strvec_push(&cp.args, "intr"); + strvec_push(&cp.args, ""); } if (run_command(&cp) == 0) @@ -273,7 +273,7 @@ static int is_known_escape_sequence(const char *sequence) hashmap_init(&sequences, (hashmap_cmp_fn)sequence_entry_cmp, NULL, 0); - argv_array_pushl(&cp.args, "infocmp", "-L", "-1", NULL); + strvec_pushl(&cp.args, "infocmp", "-L", "-1", NULL); if (pipe_command(&cp, NULL, 0, &buf, 0, NULL, 0)) strbuf_setlen(&buf, 0); -- cgit v1.2.3