aboutsummaryrefslogtreecommitdiffstats
path: root/environment.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-07-28 16:24:53 -0400
committerJunio C Hamano <gitster@pobox.com>2020-07-28 15:02:18 -0700
commitef8d7ac42a6a62d678166fe25ea743315809d2bb (patch)
tree41974632658fdc804d42d3c98859bd8f259828c8 /environment.c
parent22f9b7f3f59549735a480042a4b9ce292eedfae0 (diff)
downloadgit-ef8d7ac42a6a62d678166fe25ea743315809d2bb.tar.gz
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/environment.c b/environment.c
index 75fe5f4c56..00fe20e496 100644
--- a/environment.c
+++ b/environment.c
@@ -156,14 +156,14 @@ static char *expand_namespace(const char *raw_namespace)
* Wrapper of getenv() that returns a strdup value. This value is kept
* in argv to be freed later.
*/
-static const char *getenv_safe(struct argv_array *argv, const char *name)
+static const char *getenv_safe(struct strvec *argv, const char *name)
{
const char *value = getenv(name);
if (!value)
return NULL;
- argv_array_push(argv, value);
+ strvec_push(argv, value);
return argv->argv[argv->argc - 1];
}
@@ -172,7 +172,7 @@ void setup_git_env(const char *git_dir)
const char *shallow_file;
const char *replace_ref_base;
struct set_gitdir_args args = { NULL };
- struct argv_array to_free = ARGV_ARRAY_INIT;
+ struct strvec to_free = STRVEC_INIT;
args.commondir = getenv_safe(&to_free, GIT_COMMON_DIR_ENVIRONMENT);
args.object_dir = getenv_safe(&to_free, DB_ENVIRONMENT);
@@ -180,7 +180,7 @@ void setup_git_env(const char *git_dir)
args.index_file = getenv_safe(&to_free, INDEX_ENVIRONMENT);
args.alternate_db = getenv_safe(&to_free, ALTERNATE_DB_ENVIRONMENT);
repo_set_gitdir(the_repository, git_dir, &args);
- argv_array_clear(&to_free);
+ strvec_clear(&to_free);
if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
read_replace_refs = 0;