From 5d70192bcb80a5355323a4736e0fb44d8e2b6743 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 7 Dec 2013 14:48:05 +0100 Subject: ui/cocoa: Use macro ARRAY_SIZE where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This improves readability and simplifies the code. Cc: Andreas Färber Cc: Anthony Liguori Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- ui/cocoa.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/cocoa.m b/ui/cocoa.m index be491794dc..2524f185bc 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]; -- cgit v1.2.3