aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2006-05-19 19:29:36 +0000
committerEli Zaretskii2006-05-19 19:29:36 +0000
commit892eb2370135a8c5985ffe06d3f22fb334381965 (patch)
tree36807f4e17b4616002cae91c3fc2753871b23192 /src
parente00b99c8180dc354a8f053cefe515214274b676e (diff)
downloademacs-892eb2370135a8c5985ffe06d3f22fb334381965.tar.gz
emacs-892eb2370135a8c5985ffe06d3f22fb334381965.zip
(init_environment): Simplify code that calls ExpandEnvironmentStrings and make
buf1[] and buf2[] more visible for easier debugging.
Diffstat (limited to 'src')
-rw-r--r--src/w32.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/w32.c b/src/w32.c
index 30474b842d8..f11ffb7a785 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1095,20 +1095,17 @@ init_environment (char ** argv)
1095 1095
1096 if (lpval) 1096 if (lpval)
1097 { 1097 {
1098 if (dwType == REG_EXPAND_SZ) 1098 char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE];
1099 {
1100 char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE];
1101 1099
1102 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); 1100 if (dwType == REG_EXPAND_SZ)
1103 _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, buf1); 1101 ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1));
1104 _putenv (strdup (buf2));
1105 }
1106 else if (dwType == REG_SZ) 1102 else if (dwType == REG_SZ)
1103 strcpy (buf1, lpval);
1104 if (dwType == REG_EXPAND_SZ || dwType == REG_SZ)
1107 { 1105 {
1108 char buf[SET_ENV_BUF_SIZE]; 1106 _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name,
1109 1107 buf1);
1110 _snprintf (buf, sizeof(buf)-1, "%s=%s", env_vars[i].name, lpval); 1108 _putenv (strdup (buf2));
1111 _putenv (strdup (buf));
1112 } 1109 }
1113 1110
1114 if (!dont_free) 1111 if (!dont_free)