ui/cocoa: Use macro ARRAY_SIZE were possible
PATCH 1/1 ui/cocoa: Use macro ARRAY_SIZE were possible
This improves readability and simplifies the code.
Signed-off-by Stefan Weil <[email protected]>
---
Please note that I could not test this patch.
Regards, Stefan
ui/cocoa.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
ui/cocoa.m +2 -3
@@ -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];
Signature · 1 line
1.7.10.4