Michael Stefaniuc : libs/wine: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Thu Oct 25 15:24:35 CDT 2018


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu Oct 25 15:47:29 2018 +0200

libs/wine: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/wine/debug.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libs/wine/debug.c b/libs/wine/debug.c
index 4116b96..ae12356 100644
--- a/libs/wine/debug.c
+++ b/libs/wine/debug.c
@@ -144,7 +144,7 @@ static void parse_options( const char *str )
 
         if (p > opt)
         {
-            for (i = 0; i < sizeof(debug_classes)/sizeof(debug_classes[0]); i++)
+            for (i = 0; i < ARRAY_SIZE(debug_classes); i++)
             {
                 int len = strlen(debug_classes[i]);
                 if (len != (p - opt)) continue;
@@ -155,7 +155,7 @@ static void parse_options( const char *str )
                     break;
                 }
             }
-            if (i == sizeof(debug_classes)/sizeof(debug_classes[0])) /* bad class name, skip it */
+            if (i == ARRAY_SIZE(debug_classes)) /* bad class name, skip it */
                 continue;
         }
         else
@@ -268,7 +268,7 @@ static char *get_temp_buffer( size_t size )
     char *ret;
     int idx;
 
-    idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
+    idx = interlocked_xchg_add( &pos, 1 ) % ARRAY_SIZE(list);
     if ((ret = realloc( list[idx], size ))) list[idx] = ret;
     return ret;
 }
@@ -411,7 +411,7 @@ static int default_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_ch
         ret += wine_dbg_printf( "%04x:", GetCurrentProcessId() );
     ret += wine_dbg_printf( "%04x:", GetCurrentThreadId() );
 #endif
-    if (cls < sizeof(debug_classes)/sizeof(debug_classes[0]))
+    if (cls < ARRAY_SIZE(debug_classes))
         ret += wine_dbg_printf( "%s:%s:%s ", debug_classes[cls], channel->name, func );
     if (format)
         ret += funcs.dbg_vprintf( format, args );




More information about the wine-cvs mailing list