[PATCH] winedump: Use the ARRAY_SIZE() macro
Michael Stefaniuc
mstefani at winehq.org
Mon Oct 22 15:39:02 CDT 2018
Signed-off-by: Michael Stefaniuc <mstefani 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 f593515d68..5a7c33aa8b 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 7bbb576104..ca41bb7439 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 bed53933be..c55c6a9f23 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);
--
2.14.5
More information about the wine-devel
mailing list