regedit: Use generic ARRAY_SIZE macro to allow for broader use.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3763c7a610
commit
bb2c799f36
|
@ -50,7 +50,7 @@ static HKEY reg_class_keys[] = {
|
||||||
HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA
|
HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA
|
||||||
};
|
};
|
||||||
|
|
||||||
#define REG_CLASS_NUMBER (sizeof(reg_class_keys) / sizeof(reg_class_keys[0]))
|
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
|
||||||
|
|
||||||
/* return values */
|
/* return values */
|
||||||
#define NOT_ENOUGH_MEMORY 1
|
#define NOT_ENOUGH_MEMORY 1
|
||||||
|
@ -317,7 +317,7 @@ static BOOL parseKeyName(LPWSTR lpKeyName, HKEY *hKey, LPWSTR *lpKeyPath)
|
||||||
}
|
}
|
||||||
*hKey = NULL;
|
*hKey = NULL;
|
||||||
|
|
||||||
for (i = 0; i < REG_CLASS_NUMBER; i++) {
|
for (i = 0; i < ARRAY_SIZE(reg_class_keys); i++) {
|
||||||
if (CompareStringW(LOCALE_USER_DEFAULT, 0, lpKeyName, len, reg_class_namesW[i], -1) == CSTR_EQUAL &&
|
if (CompareStringW(LOCALE_USER_DEFAULT, 0, lpKeyName, len, reg_class_namesW[i], -1) == CSTR_EQUAL &&
|
||||||
len == lstrlenW(reg_class_namesW[i])) {
|
len == lstrlenW(reg_class_namesW[i])) {
|
||||||
*hKey = reg_class_keys[i];
|
*hKey = reg_class_keys[i];
|
||||||
|
@ -1309,7 +1309,7 @@ BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format)
|
||||||
|
|
||||||
/* export all registry classes */
|
/* export all registry classes */
|
||||||
file = REGPROC_open_export_file(file_name, unicode);
|
file = REGPROC_open_export_file(file_name, unicode);
|
||||||
for (i = 0; i < REG_CLASS_NUMBER; i++) {
|
for (i = 0; i < ARRAY_SIZE(reg_class_keys); i++) {
|
||||||
/* do not export HKEY_CLASSES_ROOT */
|
/* do not export HKEY_CLASSES_ROOT */
|
||||||
if (reg_class_keys[i] != HKEY_CLASSES_ROOT &&
|
if (reg_class_keys[i] != HKEY_CLASSES_ROOT &&
|
||||||
reg_class_keys[i] != HKEY_CURRENT_USER &&
|
reg_class_keys[i] != HKEY_CURRENT_USER &&
|
||||||
|
|
Loading…
Reference in New Issue