[PATCH] vbscript: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Wed Jul 18 16:01:34 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/vbscript/global.c        | 6 +++---
 dlls/vbscript/lex.c           | 2 +-
 dlls/vbscript/vbdisp.c        | 4 ++--
 dlls/vbscript/vbscript_main.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index a5df54acad..87adeca9bc 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -334,7 +334,7 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR o
                 return E_OUTOFMEMORY;
 
             memcpy(title_buf, vbscriptW, sizeof(vbscriptW));
-            ptr = title_buf + sizeof(vbscriptW)/sizeof(WCHAR)-1;
+            ptr = title_buf + ARRAY_SIZE(vbscriptW)-1;
 
             *ptr++ = ':';
             *ptr++ = ' ';
@@ -2446,7 +2446,7 @@ HRESULT init_global(script_ctx_t *ctx)
     HRESULT hres;
 
     ctx->global_desc.ctx = ctx;
-    ctx->global_desc.builtin_prop_cnt = sizeof(global_props)/sizeof(*global_props);
+    ctx->global_desc.builtin_prop_cnt = ARRAY_SIZE(global_props);
     ctx->global_desc.builtin_props = global_props;
 
     hres = get_typeinfo(GlobalObj_tid, &ctx->global_desc.typeinfo);
@@ -2462,7 +2462,7 @@ HRESULT init_global(script_ctx_t *ctx)
         return hres;
 
     ctx->err_desc.ctx = ctx;
-    ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props);
+    ctx->err_desc.builtin_prop_cnt = ARRAY_SIZE(err_props);
     ctx->err_desc.builtin_props = err_props;
 
     hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo);
diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c
index b0fac48cad..571854db58 100644
--- a/dlls/vbscript/lex.c
+++ b/dlls/vbscript/lex.c
@@ -179,7 +179,7 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word)
 
 static int check_keywords(parser_ctx_t *ctx)
 {
-    int min = 0, max = sizeof(keywords)/sizeof(keywords[0])-1, r, i;
+    int min = 0, max = ARRAY_SIZE(keywords)-1, r, i;
 
     while(min <= max) {
         i = (min+max)/2;
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c
index 9c0c4c1d9a..e72eadf13d 100644
--- a/dlls/vbscript/vbdisp.c
+++ b/dlls/vbscript/vbdisp.c
@@ -236,7 +236,7 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f
         return E_FAIL;
     }
 
-    assert(argn < sizeof(args)/sizeof(*args));
+    assert(argn < ARRAY_SIZE(args));
 
     for(i=0; i < argn; i++) {
         if(V_VT(dp->rgvarg+dp->cArgs-i-1) == (VT_BYREF|VT_VARIANT))
@@ -647,7 +647,7 @@ HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **re
         return E_OUTOFMEMORY;
 
     desc->ctx = ctx;
-    desc->builtin_prop_cnt = sizeof(procedure_props)/sizeof(*procedure_props);
+    desc->builtin_prop_cnt = ARRAY_SIZE(procedure_props);
     desc->builtin_props = procedure_props;
     desc->value_func = &code->main_code;
 
diff --git a/dlls/vbscript/vbscript_main.c b/dlls/vbscript/vbscript_main.c
index 7b7161c21e..786b7fb898 100644
--- a/dlls/vbscript/vbscript_main.c
+++ b/dlls/vbscript/vbscript_main.c
@@ -87,7 +87,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]);
     }
-- 
2.14.4




More information about the wine-devel mailing list