diff options
author | Eli Zaretskii <eliz@gnu.org> | 2006-05-19 19:29:36 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2006-05-19 19:29:36 +0000 |
commit | 892eb2370135a8c5985ffe06d3f22fb334381965 (patch) | |
tree | 36807f4e17b4616002cae91c3fc2753871b23192 /src/w32.c | |
parent | e00b99c8180dc354a8f053cefe515214274b676e (diff) | |
download | emacs-892eb2370135a8c5985ffe06d3f22fb334381965.tar.gz |
(init_environment): Simplify code that calls ExpandEnvironmentStrings and make
buf1[] and buf2[] more visible for easier debugging.
Diffstat (limited to 'src/w32.c')
-rw-r--r-- | src/w32.c | 19 |
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) if (lpval) { - if (dwType == REG_EXPAND_SZ) - { - char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; + char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; - ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); - _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, buf1); - _putenv (strdup (buf2)); - } + if (dwType == REG_EXPAND_SZ) + ExpandEnvironmentStrings ((LPSTR) lpval, buf1, sizeof(buf1)); else if (dwType == REG_SZ) + strcpy (buf1, lpval); + if (dwType == REG_EXPAND_SZ || dwType == REG_SZ) { - char buf[SET_ENV_BUF_SIZE]; - - _snprintf (buf, sizeof(buf)-1, "%s=%s", env_vars[i].name, lpval); - _putenv (strdup (buf)); + _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, + buf1); + _putenv (strdup (buf2)); } if (!dont_free) |