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

Commit a5261a8

Browse files
kbleeskasal
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]>
1 parent 8cd6c47 commit a5261a8

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
@@ -713,14 +713,14 @@ char *mingw_getcwd(char *pointer, int len)
713713
return pointer;
714714
}
715715

716-
static int env_compare(const void *a, const void *b)
716+
static int compareenv(const void *a, const void *b)
717717
{
718718
char *const *ea = a;
719719
char *const *eb = b;
720720
return strcasecmp(*ea, *eb);
721721
}
722722

723-
static int lookup_env(char **env, const char *name, size_t nmln)
723+
static int lookupenv(char **env, const char *name, size_t nmln)
724724
{
725725
int i;
726726

@@ -735,10 +735,10 @@ static int lookup_env(char **env, const char *name, size_t nmln)
735735
/*
736736
* If name contains '=', then sets the variable, otherwise it unsets it
737737
*/
738-
static char **env_setenv(char **env, const char *name)
738+
static char **do_putenv(char **env, const char *name)
739739
{
740740
char *eq = strchrnul(name, '=');
741-
int i = lookup_env(env, name, eq-name);
741+
int i = lookupenv(env, name, eq-name);
742742

743743
if (i < 0) {
744744
if (*eq) {
@@ -779,7 +779,7 @@ char *mingw_getenv(const char *name)
779779

780780
int mingw_putenv(const char *namevalue)
781781
{
782-
environ = env_setenv(environ, namevalue);
782+
environ = do_putenv(environ, namevalue);
783783
return 0;
784784
}
785785

@@ -1052,7 +1052,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
10521052
/* environment must be sorted */
10531053
sorted_env = xmalloc(sizeof(*sorted_env) * (count + 1));
10541054
memcpy(sorted_env, env, sizeof(*sorted_env) * (count + 1));
1055-
qsort(sorted_env, count, sizeof(*sorted_env), env_compare);
1055+
qsort(sorted_env, count, sizeof(*sorted_env), compareenv);
10561056

10571057
/* create environment block from temporary environment */
10581058
for (e = sorted_env; *e; e++) {
@@ -1262,7 +1262,7 @@ char **make_augmented_environ(const char *const *vars)
12621262

12631263
while (*vars) {
12641264
const char *v = *vars++;
1265-
env = env_setenv(env, strchr(v, '=') ? xstrdup(v) : v);
1265+
env = do_putenv(env, strchr(v, '=') ? xstrdup(v) : v);
12661266
}
12671267
return env;
12681268
}

0 commit comments

Comments
 (0)