[PATCH] libs/wine: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Thu Oct 25 08:47:29 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani 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 4116b9614a..ae12356cde 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 );
-- 
2.14.5




More information about the wine-devel mailing list