qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible


From: Stefan Weil
Subject: [Qemu-trivial] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible
Date: Sat, 7 Dec 2013 09:45:21 +0100

This improves readability and simplifies the code.

Signed-off-by: Stefan Weil <address@hidden>
---

Please note that I could not test this patch.

Regards, Stefan

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]