Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 26c7b21

Browse files
kbleesgitster
authored andcommitted
Win32: unify environment function names
Environment helper functions use random naming ('env' prefix or suffix or both, with or without '_'). Change to POSIX naming scheme ('env' suffix, no '_'). Env_setenv has more in common with putenv than setenv. Change to do_putenv. Signed-off-by: Karsten Blees <[email protected]> Signed-off-by: Stepan Kasal <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38d2750 commit 26c7b21

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compat/mingw.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static char *path_lookup(const char *cmd, char **path, int exe_only)
899899
return prog;
900900
}
901901

902-
static int env_compare(const void *a, const void *b)
902+
static int compareenv(const void *a, const void *b)
903903
{
904904
char *const *ea = a;
905905
char *const *eb = b;
@@ -993,7 +993,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
993993
/* environment must be sorted */
994994
sorted_env = xmalloc(sizeof(*sorted_env) * (count + 1));
995995
memcpy(sorted_env, env, sizeof(*sorted_env) * (count + 1));
996-
qsort(sorted_env, count, sizeof(*sorted_env), env_compare);
996+
qsort(sorted_env, count, sizeof(*sorted_env), compareenv);
997997

998998
/* create environment block from temporary environment */
999999
for (e = sorted_env; *e; e++) {
@@ -1194,7 +1194,7 @@ void free_environ(char **env)
11941194
free(env);
11951195
}
11961196

1197-
static int lookup_env(char **env, const char *name, size_t nmln)
1197+
static int lookupenv(char **env, const char *name, size_t nmln)
11981198
{
11991199
int i;
12001200

@@ -1209,10 +1209,10 @@ static int lookup_env(char **env, const char *name, size_t nmln)
12091209
/*
12101210
* If name contains '=', then sets the variable, otherwise it unsets it
12111211
*/
1212-
static char **env_setenv(char **env, const char *name)
1212+
static char **do_putenv(char **env, const char *name)
12131213
{
12141214
char *eq = strchrnul(name, '=');
1215-
int i = lookup_env(env, name, eq-name);
1215+
int i = lookupenv(env, name, eq-name);
12161216

12171217
if (i < 0) {
12181218
if (*eq) {
@@ -1243,7 +1243,7 @@ char **make_augmented_environ(const char *const *vars)
12431243

12441244
while (*vars) {
12451245
const char *v = *vars++;
1246-
env = env_setenv(env, strchr(v, '=') ? xstrdup(v) : v);
1246+
env = do_putenv(env, strchr(v, '=') ? xstrdup(v) : v);
12471247
}
12481248
return env;
12491249
}
@@ -1263,7 +1263,7 @@ char *mingw_getenv(const char *name)
12631263

12641264
int mingw_putenv(const char *namevalue)
12651265
{
1266-
environ = env_setenv(environ, namevalue);
1266+
environ = do_putenv(environ, namevalue);
12671267
return 0;
12681268
}
12691269

0 commit comments

Comments
 (0)