summaryrefslogtreecommitdiff
path: root/ui/cocoa.m
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2013-12-07 14:48:05 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2013-12-23 16:02:19 +0400
commit5d70192bcb80a5355323a4736e0fb44d8e2b6743 (patch)
tree7dcb7e5fe96896218c99747ad17f038daacc3040 /ui/cocoa.m
parentdff7424dc09635c33b42193fbb40c90fc9a971f4 (diff)
downloadqemu-5d70192bcb80a5355323a4736e0fb44d8e2b6743.tar.gz
qemu-5d70192bcb80a5355323a4736e0fb44d8e2b6743.tar.bz2
qemu-5d70192bcb80a5355323a4736e0fb44d8e2b6743.zip
ui/cocoa: Use macro ARRAY_SIZE where possible
This improves readability and simplifies the code. Cc: Andreas Färber <andreas.faerber@web.de> Cc: Anthony Liguori <aliguori@amazon.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r--ui/cocoa.m5
1 files changed, 2 insertions, 3 deletions
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];