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 <blees@dcon.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Karsten Blees committed Jul 17, 2014 at 17:37 UTC 26c7b21ab107bea5d7c308fa5c286af54dfd8cec
1 file changed +7 -7
compat/mingw.c
+7 -7
@@ -899,7 +899,7 @@ static char *path_lookup(const char *cmd, char **path, int exe_only)
899 return prog;
900 }
901
902 -static int env_compare(const void *a, const void *b)
902 +static int compareenv(const void *a, const void *b)
903 {
904 char *const *ea = a;
905 char *const *eb = b;
@@ -993,7 +993,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
993 /* environment must be sorted */
994 sorted_env = xmalloc(sizeof(*sorted_env) * (count + 1));
995 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);
997
998 /* create environment block from temporary environment */
999 for (e = sorted_env; *e; e++) {
@@ -1194,7 +1194,7 @@ void free_environ(char **env)
1194 free(env);
1195 }
1196
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)
1198 {
1199 int i;
1200
@@ -1209,10 +1209,10 @@ static int lookup_env(char **env, const char *name, size_t nmln)
1209 /*
1210 * If name contains '=', then sets the variable, otherwise it unsets it
1211 */
1212 -static char **env_setenv(char **env, const char *name)
1212 +static char **do_putenv(char **env, const char *name)
1213 {
1214 char *eq = strchrnul(name, '=');
1215 - int i = lookup_env(env, name, eq-name);
1215 + int i = lookupenv(env, name, eq-name);
1216
1217 if (i < 0) {
1218 if (*eq) {
@@ -1243,7 +1243,7 @@ char **make_augmented_environ(const char *const *vars)
1243
1244 while (*vars) {
1245 const char *v = *vars++;
1246 - env = env_setenv(env, strchr(v, '=') ? xstrdup(v) : v);
1246 + env = do_putenv(env, strchr(v, '=') ? xstrdup(v) : v);
1247 }
1248 return env;
1249 }
@@ -1263,7 +1263,7 @@ char *mingw_getenv(const char *name)
1263
1264 int mingw_putenv(const char *namevalue)
1265 {
1266 - environ = env_setenv(environ, namevalue);
1266 + environ = do_putenv(environ, namevalue);
1267 return 0;
1268 }
1269