Received: from eggs.gnu.org ([2001:4830:134:3::10]:51406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpDVu-0000WB-1u for qemu-devel@nongnu.org; Sat, 07 Dec 2013 03:45:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpDVs-0005Ns-7s for qemu-devel@nongnu.org; Sat, 07 Dec 2013 03:45:25 -0500 From: Stefan Weil Date: Sat, 7 Dec 2013 09:45:21 +0100 Message-Id: <1386405921-18219-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: qemu-trivial@nongnu.org, Stefan Weil , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori This improves readability and simplifies the code. Signed-off-by: Stefan Weil --- Please note that I could not test this patch. Regards, Stefan ui/cocoa.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index be49179..2524f18 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -240,9 +240,8 @@ int keymap[] = static int cocoa_keycode_to_qemu(int keycode) { - if((sizeof(keymap)/sizeof(int)) <= keycode) - { - printf("(cocoa) warning unknow keycode 0x%x\n", keycode); + if (ARRAY_SIZE(keymap) <= keycode) { + printf("(cocoa) warning unknown keycode 0x%x\n", keycode); return 0; } return keymap[keycode]; -- 1.7.10.4