[PATCH] advapi32: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Mon Nov 12 13:29:04 CST 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/advapi32/registry.c | 8 ++++----
 dlls/advapi32/service.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index 9989097ff4..b537f69db0 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -108,7 +108,7 @@ static BOOL is_wow6432node( const UNICODE_STRING *name )
     static const WCHAR wow6432nodeW[] = {'W','o','w','6','4','3','2','N','o','d','e'};
 
     return (name->Length == sizeof(wow6432nodeW) &&
-            !memicmpW( name->Buffer, wow6432nodeW, sizeof(wow6432nodeW)/sizeof(WCHAR) ));
+            !memicmpW( name->Buffer, wow6432nodeW, ARRAY_SIZE( wow6432nodeW )));
 }
 
 /* open the Wow6432Node subkey of the specified key */
@@ -148,9 +148,9 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES
         UNICODE_STRING str;
 
         /* don't try to create registry root */
-        if (!attr->RootDirectory && len > sizeof(registry_root)/sizeof(WCHAR) &&
-            !memicmpW( buffer, registry_root, sizeof(registry_root)/sizeof(WCHAR)))
-            i += sizeof(registry_root)/sizeof(WCHAR);
+        if (!attr->RootDirectory && len > ARRAY_SIZE( registry_root ) &&
+            !memicmpW( buffer, registry_root, ARRAY_SIZE( registry_root )))
+            i += ARRAY_SIZE( registry_root );
 
         while (i < len && buffer[i] != '\\') i++;
         if (i == len && !force_wow32) return status;
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 718c964b20..231f0267e9 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -299,7 +299,7 @@ static LPWSTR service_get_pipe_name(void)
     RegCloseKey(service_current_key);
     if (ret != ERROR_SUCCESS || type != REG_DWORD)
         return NULL;
-    len = sizeof(format)/sizeof(WCHAR) + 10 /* strlenW("4294967295") */;
+    len = ARRAY_SIZE(format) + 10 /* strlenW("4294967295") */;
     name = heap_alloc(len * sizeof(WCHAR));
     if (!name)
         return NULL;
-- 
2.14.5




More information about the wine-devel mailing list