strvec: convert builtin/ 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 all of the files in builtin/ 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 builtin/". We'll deal with any indentation/style fallouts separately. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2745b6b450
commit
22f9b7f3f5
@ -188,7 +188,7 @@ int run_add_interactive(const char *revision, const char *patch_mode,
|
||||
const struct pathspec *pathspec)
|
||||
{
|
||||
int status, i;
|
||||
struct argv_array argv = ARGV_ARRAY_INIT;
|
||||
struct strvec argv = STRVEC_INIT;
|
||||
int use_builtin_add_i =
|
||||
git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
|
||||
|
||||
@ -218,18 +218,18 @@ int run_add_interactive(const char *revision, const char *patch_mode,
|
||||
return !!run_add_p(the_repository, mode, revision, pathspec);
|
||||
}
|
||||
|
||||
argv_array_push(&argv, "add--interactive");
|
||||
strvec_push(&argv, "add--interactive");
|
||||
if (patch_mode)
|
||||
argv_array_push(&argv, patch_mode);
|
||||
strvec_push(&argv, patch_mode);
|
||||
if (revision)
|
||||
argv_array_push(&argv, revision);
|
||||
argv_array_push(&argv, "--");
|
||||
strvec_push(&argv, revision);
|
||||
strvec_push(&argv, "--");
|
||||
for (i = 0; i < pathspec->nr; i++)
|
||||
/* pass original pathspec, to be re-parsed */
|
||||
argv_array_push(&argv, pathspec->items[i].original);
|
||||
strvec_push(&argv, pathspec->items[i].original);
|
||||
|
||||
status = run_command_v_opt(argv.argv, RUN_GIT_CMD);
|
||||
argv_array_clear(&argv);
|
||||
strvec_clear(&argv);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user