From b1503cda1e78cad4dca522ddbb4c69f4c6869bcd Mon Sep 17 00:00:00 2001 From: malc Date: Mon, 22 Dec 2008 20:33:55 +0000 Subject: Use the ARRAY_SIZE() macro where appropriate. Change from v1: Avoid changing the existing coding style in certain files. Signed-off-by: Stuart Brady git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162 --- darwin-user/commpage.c | 4 ++-- darwin-user/syscall.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'darwin-user') diff --git a/darwin-user/commpage.c b/darwin-user/commpage.c index 78a14130a1..7228872921 100644 --- a/darwin-user/commpage.c +++ b/darwin-user/commpage.c @@ -191,7 +191,7 @@ void commpage_init(void) /* XXX: commpage data not handled */ - for(i = 0; i < sizeof(commpage_entries)/sizeof(commpage_entries[0]); i++) + for(i = 0; i < ARRAY_SIZE(commpage_entries); i++) install_commpage_backdoor_for_entry(commpage_entries[i]); #else /* simply map our pages so they can be executed @@ -329,7 +329,7 @@ do_commpage(void *cpu_env, int num, uint32_t arg1, uint32_t arg2, uint32_t arg3, num = num-COMMPAGE_START-2; - for(i = 0; i < sizeof(commpage_entries)/sizeof(commpage_entries[0]); i++) { + for(i = 0; i < ARRAY_SIZE(commpage_entries); i++) { if( num == commpage_code_num(&commpage_entries[i]) ) { DPRINTF("commpage: %s %s\n", commpage_entries[i].name, commpage_is_indirect(&commpage_entries[i]) ? "[indirect]" : "[direct]"); diff --git a/darwin-user/syscall.c b/darwin-user/syscall.c index 8bf365d4b2..58ead95f16 100644 --- a/darwin-user/syscall.c +++ b/darwin-user/syscall.c @@ -135,7 +135,7 @@ void static inline print_description_msg_header(mach_msg_header_t *hdr) { 4241876, "lu_message_reply_id" }, /* lookupd */ }; - for(i = 0; i < sizeof(msg_name)/sizeof(msg_name[0]); i++) { + for(i = 0; i < ARRAY_SIZE(msg_name); i++) { if(msg_name[i].number == hdr->msgh_id) { name = msg_name[i].name; @@ -210,7 +210,7 @@ static inline void print_mach_msg_return(mach_msg_return_t ret) DPRINTF("MACH_MSG_SUCCESS\n"); else { - for( i = 0; i < sizeof(msg_name)/sizeof(msg_name[0]); i++) { + for( i = 0; i < ARRAY_SIZE(msg_name); i++) { if(msg_name[i].code == ret) { DPRINTF("%s\n", msg_name[i].name); found = 1; -- cgit v1.2.3