Mercurial > emacs
changeset 70740:f263eba56074
(init_environment): Simplify code that calls ExpandEnvironmentStrings and make
buf1[] and buf2[] more visible for easier debugging.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 19 May 2006 19:29:36 +0000 |
parents | 765811a003d9 |
children | 0e29340d15dc |
files | src/w32.c |
diffstat | 1 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/w32.c Fri May 19 19:05:07 2006 +0000 +++ b/src/w32.c Fri May 19 19:29:36 2006 +0000 @@ -1095,21 +1095,18 @@ if (lpval) { + char buf1[SET_ENV_BUF_SIZE], buf2[SET_ENV_BUF_SIZE]; + 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 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); + _snprintf (buf2, sizeof(buf2)-1, "%s=%s", env_vars[i].name, + buf1); _putenv (strdup (buf2)); } - else if (dwType == REG_SZ) - { - char buf[SET_ENV_BUF_SIZE]; - - _snprintf (buf, sizeof(buf)-1, "%s=%s", env_vars[i].name, lpval); - _putenv (strdup (buf)); - } if (!dont_free) xfree (lpval);