Commit 892eb237 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

(init_environment): Simplify code that calls ExpandEnvironmentStrings and make

buf1[] and buf2[] more visible for easier debugging.
parent e00b99c8
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment