Nikolay Sivov : scrrun: Use ARRAY_SIZE() macro.
Alexandre Julliard
julliard at winehq.org
Tue Feb 27 17:29:33 CST 2018
Module: wine
Branch: master
Commit: 71627251332eda48274f72a9e96c81e3d251ba8d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=71627251332eda48274f72a9e96c81e3d251ba8d
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Feb 27 01:47:22 2018 +0300
scrrun: Use ARRAY_SIZE() macro.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/scrrun/filesystem.c | 6 +++---
dlls/scrrun/scrrun.c | 2 +-
dlls/scrrun/scrrun_private.h | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 228a5e9..0527531 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -3441,13 +3441,13 @@ static HRESULT WINAPI filesys_GetSpecialFolder(IFileSystem3 *iface,
switch (SpecialFolder)
{
case WindowsFolder:
- ret = GetWindowsDirectoryW(pathW, sizeof(pathW)/sizeof(WCHAR));
+ ret = GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
break;
case SystemFolder:
- ret = GetSystemDirectoryW(pathW, sizeof(pathW)/sizeof(WCHAR));
+ ret = GetSystemDirectoryW(pathW, ARRAY_SIZE(pathW));
break;
case TemporaryFolder:
- ret = GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
+ ret = GetTempPathW(ARRAY_SIZE(pathW), pathW);
/* we don't want trailing backslash */
if (ret && pathW[ret-1] == '\\')
pathW[ret-1] = 0;
diff --git a/dlls/scrrun/scrrun.c b/dlls/scrrun/scrrun.c
index 5a0513f..8c60c80 100644
--- a/dlls/scrrun/scrrun.c
+++ b/dlls/scrrun/scrrun.c
@@ -180,7 +180,7 @@ static void release_typelib(void)
if(!typelib)
return;
- for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
diff --git a/dlls/scrrun/scrrun_private.h b/dlls/scrrun/scrrun_private.h
index 5083d30..d9ff241 100644
--- a/dlls/scrrun/scrrun_private.h
+++ b/dlls/scrrun/scrrun_private.h
@@ -18,6 +18,8 @@
#ifndef _SCRRUN_PRIVATE_H_
#define _SCRRUN_PRIVATE_H_
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
extern HRESULT WINAPI FileSystem_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
extern HRESULT WINAPI Dictionary_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list