userenv: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2018-08-08 22:20:05 +02:00 committed by Alexandre Julliard
parent b2fc591748
commit 53a3c77c98
1 changed files with 5 additions and 5 deletions

View File

@ -106,20 +106,20 @@ static void set_registry_variables(WCHAR **env, HKEY hkey, DWORD type, BOOL set_
for (index = 0; ; index++) for (index = 0; ; index++)
{ {
size = sizeof(name)/sizeof(WCHAR); size = ARRAY_SIZE(name);
ret = RegEnumValueW(hkey, index, name, &size, NULL, NULL, NULL, NULL); ret = RegEnumValueW(hkey, index, name, &size, NULL, NULL, NULL, NULL);
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
break; break;
if (!memicmpW(name, SystemRootW, sizeof(SystemRootW)/sizeof(WCHAR))) if (!memicmpW(name, SystemRootW, ARRAY_SIZE(SystemRootW)))
continue; continue;
if (!memicmpW(name, SystemDriveW, sizeof(SystemDriveW)/sizeof(WCHAR))) if (!memicmpW(name, SystemDriveW, ARRAY_SIZE(SystemDriveW)))
continue; continue;
RtlInitUnicodeString(&us_name, name); RtlInitUnicodeString(&us_name, name);
us_value.Buffer = value; us_value.Buffer = value;
us_value.MaximumLength = sizeof(value); us_value.MaximumLength = sizeof(value);
if (!memicmpW(name, PATHW, sizeof(PATHW)/sizeof(WCHAR)) && if (!memicmpW(name, PATHW, ARRAY_SIZE(PATHW)) &&
!RtlQueryEnvironmentVariable_U(*env, &us_name, &us_value)) !RtlQueryEnvironmentVariable_U(*env, &us_name, &us_value))
{ {
if (!set_path) if (!set_path)
@ -339,7 +339,7 @@ BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment,
RegCloseKey(hkey); RegCloseKey(hkey);
} }
len = sizeof(buf)/sizeof(WCHAR); len = ARRAY_SIZE(buf);
if (GetComputerNameW(buf, &len)) if (GetComputerNameW(buf, &len))
{ {
RtlInitUnicodeString(&us_name, COMPUTERNAMEW); RtlInitUnicodeString(&us_name, COMPUTERNAMEW);