Michael Stefaniuc : msvcr120/tests: Use the available ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Mon Jun 11 13:10:50 CDT 2018


Module: wine
Branch: master
Commit: dd8a9897effa3f0b2fe67c5586e300bea2e02530
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dd8a9897effa3f0b2fe67c5586e300bea2e02530

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Jun  6 00:38:35 2018 +0200

msvcr120/tests: Use the available ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcr120/tests/msvcr120.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c
index 152bfdf..85e83a6 100644
--- a/dlls/msvcr120/tests/msvcr120.c
+++ b/dlls/msvcr120/tests/msvcr120.c
@@ -408,7 +408,7 @@ static void test_lconv(void)
         "Japanese", "Korean", "Spanish"
     };
 
-    for(i = 0; i < sizeof(locstrs) / sizeof(char *); i ++)
+    for(i = 0; i < ARRAY_SIZE(locstrs); i ++)
         test_lconv_helper(locstrs[i]);
 }
 
@@ -445,7 +445,7 @@ static void test__dpcomp(void)
     };
     int i, ret;
 
-    for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+    for(i=0; i<ARRAY_SIZE(tests); i++) {
         ret = p__dpcomp(tests[i].x, tests[i].y);
         ok(ret == tests[i].ret, "%d) dpcomp(%f, %f) = %x\n", i, tests[i].x, tests[i].y, ret);
     }
@@ -473,7 +473,7 @@ static void test____lc_locale_name_func(void)
     int i, j;
     wchar_t **lc_names;
 
-    for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+    for(i=0; i<ARRAY_SIZE(tests); i++) {
         if(!p_setlocale(LC_ALL, tests[i].locale))
             continue;
 
@@ -536,12 +536,11 @@ static void test__W_Gettnames(void)
     else
         ok(size==0x164, "structure size: %x\n", size);
 
-    for(i=0; i<sizeof(str)/sizeof(*str); i++) {
+    for(i=0; i<ARRAY_SIZE(str); i++) {
         ok(!strcmp(ret->str[i], str[i]), "ret->str[%d] = %s, expected %s\n",
                 i, ret->str[i], str[i]);
 
-        MultiByteToWideChar(CP_ACP, 0, str[i], strlen(str[i])+1,
-                buf, sizeof(buf)/sizeof(*buf));
+        MultiByteToWideChar(CP_ACP, 0, str[i], strlen(str[i])+1, buf, ARRAY_SIZE(buf));
         ok(!lstrcmpW(ret->wstr[i], buf), "ret->wstr[%d] = %s, expected %s\n",
                 i, wine_dbgstr_w(ret->wstr[i]), wine_dbgstr_w(buf));
     }
@@ -640,7 +639,7 @@ static void test_remainder(void)
     if(sizeof(void*) != 8) /* errno handling slightly different on 32-bit */
         return;
 
-    for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+    for(i=0; i<ARRAY_SIZE(tests); i++) {
         errno = -1;
         r = p_remainder(tests[i].x, tests[i].y);
         e = errno;
@@ -907,7 +906,7 @@ static void test_wctype(void)
     };
     int i, ret;
 
-    for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++) {
+    for(i=0; i<ARRAY_SIZE(properties); i++) {
         ret = p_wctype(properties[i].name);
         ok(properties[i].mask == ret, "%d - Expected %x, got %x\n", i, properties[i].mask, ret);
     }




More information about the wine-cvs mailing list