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>
This commit is contained in:
Stefan Weil 2013-12-07 14:48:05 +01:00 committed by Michael Tokarev
parent dff7424dc0
commit 5d70192bcb

View File

@ -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];