From d70a9eb611a9d242c1d26847d223b8677609305b Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Jul 2020 20:37:20 -0400 Subject: strvec: rename struct fields The "argc" and "argv" names made sense when the struct was argv_array, but now they're just confusing. Let's rename them to "nr" (which we use for counts elsewhere) and "v" (which is rather terse, but reads well when combined with typical variable names like "args.v"). Note that we have to update all of the callers immediately. Playing tricks with the preprocessor is hard here, because we wouldn't want to rewrite unrelated tokens. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- add-patch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'add-patch.c') diff --git a/add-patch.c b/add-patch.c index 8c0772803b..0f68eb665e 100644 --- a/add-patch.c +++ b/add-patch.c @@ -391,14 +391,14 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps) get_oid("HEAD", &oid) ? empty_tree_oid_hex() : s->revision); } - color_arg_index = args.argc; + color_arg_index = args.nr; /* Use `--no-color` explicitly, just in case `diff.color = always`. */ strvec_pushl(&args, "--no-color", "-p", "--", NULL); for (i = 0; i < ps->nr; i++) strvec_push(&args, ps->items[i].original); setup_child_process(s, &cp, NULL); - cp.argv = args.argv; + cp.argv = args.v; res = capture_command(&cp, plain, 0); if (res) { strvec_clear(&args); @@ -415,8 +415,8 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps) const char *diff_filter = s->s.interactive_diff_filter; setup_child_process(s, &colored_cp, NULL); - xsnprintf((char *)args.argv[color_arg_index], 8, "--color"); - colored_cp.argv = args.argv; + xsnprintf((char *)args.v[color_arg_index], 8, "--color"); + colored_cp.argv = args.v; colored = &s->colored; res = capture_command(&colored_cp, colored, 0); strvec_clear(&args); -- cgit v1.2.3