qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible
@ 2013-12-07  8:45 Stefan Weil
  0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2013-12-07  8:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Stefan Weil, Andreas Färber, Anthony Liguori

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(-)

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-07  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07  8:45 [Qemu-trivial] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).