Skip to contentSkip to conversation

ui/cocoa: Use macro ARRAY_SIZE were possible

PATCH New Stefan Weil 1 participant 1 message Dec 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/cocoa: Use macro ARRAY_SIZE were possible

This improves readability and simplifies the code.

---

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
index be49179..2524f18 100644
@@ -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