Michael Stefaniuc : winedump: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Tue Oct 23 16:10:01 CDT 2018


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Mon Oct 22 22:39:02 2018 +0200

winedump: Use the ARRAY_SIZE() macro.

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

---

 tools/winedump/lib.c | 4 ++--
 tools/winedump/pe.c  | 2 +-
 tools/winedump/tlb.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/winedump/lib.c b/tools/winedump/lib.c
index f593515..5a7c33a 100644
--- a/tools/winedump/lib.c
+++ b/tools/winedump/lib.c
@@ -68,8 +68,8 @@ static void dump_import_object(const IMPORT_OBJECT_HEADER *ioh)
         name = (const char *)ioh + sizeof(*ioh);
         printf("  DLL name     : %s\n", name + strlen(name) + 1);
         printf("  Symbol name  : %s\n", name);
-        printf("  Type         : %s\n", (ioh->Type < sizeof(obj_type)/sizeof(obj_type[0])) ? obj_type[ioh->Type] : "unknown");
-        printf("  Name type    : %s\n", (ioh->NameType < sizeof(name_type)/sizeof(name_type[0])) ? name_type[ioh->NameType] : "unknown");
+        printf("  Type         : %s\n", (ioh->Type < ARRAY_SIZE(obj_type)) ? obj_type[ioh->Type] : "unknown");
+        printf("  Name type    : %s\n", (ioh->NameType < ARRAY_SIZE(name_type)) ? name_type[ioh->NameType] : "unknown");
         printf("  %-13s: %u\n", (ioh->NameType == IMPORT_OBJECT_ORDINAL) ? "Ordinal" : "Hint", ioh->u.Ordinal);
         printf("\n");
     }
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 7bbb576..ca41bb7 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -1654,7 +1654,7 @@ static const char *get_resource_type( unsigned int id )
         "RT_MANIFEST"
     };
 
-    if ((size_t)id < sizeof(types)/sizeof(types[0])) return types[id];
+    if ((size_t)id < ARRAY_SIZE(types)) return types[id];
     return NULL;
 }
 
diff --git a/tools/winedump/tlb.c b/tools/winedump/tlb.c
index bed5393..c55c6a9 100644
--- a/tools/winedump/tlb.c
+++ b/tools/winedump/tlb.c
@@ -1000,7 +1000,7 @@ static void dump_msft_segdir(void)
 
     print_begin_block("SegDir");
 
-    for(i=0; i < sizeof(segdir)/sizeof(segdir[0]); i++)
+    for(i=0; i < ARRAY_SIZE(segdir); i++)
         dump_msft_seg(segdir+i);
 
     print_end_block();
@@ -1010,7 +1010,7 @@ static BOOL dump_offset(void)
 {
     int i;
 
-    for(i=0; i < sizeof(segdir)/sizeof(segdir[0]); i++)
+    for(i=0; i < ARRAY_SIZE(segdir); i++)
         if(segdir[i].offset == offset)
             return segdir[i].func(segdir+i);
 




More information about the wine-cvs mailing list