From bb2c799f3656c70155b04da8f4852de89fa1d50e Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Thu, 21 Jul 2016 05:48:43 +0000 Subject: [PATCH] regedit: Use generic ARRAY_SIZE macro to allow for broader use. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- programs/regedit/regproc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index be6f7a5a67d..eefa35fb7d1 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -50,7 +50,7 @@ static HKEY reg_class_keys[] = { 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 */ #define NOT_ENOUGH_MEMORY 1 @@ -317,7 +317,7 @@ static BOOL parseKeyName(LPWSTR lpKeyName, HKEY *hKey, LPWSTR *lpKeyPath) } *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 && len == lstrlenW(reg_class_namesW[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 */ 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 */ if (reg_class_keys[i] != HKEY_CLASSES_ROOT && reg_class_keys[i] != HKEY_CURRENT_USER &&