vbscript: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-18 23:01:34 +02:00 committed by Alexandre Julliard
parent 5f34d56dcb
commit b4a24c6575
4 changed files with 7 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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]);
}