Patchwork ui/cocoa: Use macro ARRAY_SIZE were possible

login
register
mail settings
Submitter Stefan Weil
Date Dec. 7, 2013, 8:45 a.m.
Message ID <1386405921-18219-1-git-send-email-sw@weilnetz.de>
Download mbox | patch
Permalink /patch/298636/
State Superseded
Headers show

Comments

Stefan Weil - Dec. 7, 2013, 8:45 a.m.
This improves readability and simplifies the code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

Please note that I could not test this patch.

Regards, Stefan

 ui/cocoa.m |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index be49179..2524f18 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];