From: Stefan Weil <sw@weilnetz.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: qemu-trivial@nongnu.org, "Stefan Weil" <sw@weilnetz.de>,
"Andreas Färber" <andreas.faerber@web.de>,
"Anthony Liguori" <aliguori@amazon.com>
Subject: [Qemu-trivial] [PATCH] ui/cocoa: Use macro ARRAY_SIZE were possible
Date: Sat, 7 Dec 2013 09:45:21 +0100 [thread overview]
Message-ID: <1386405921-18219-1-git-send-email-sw@weilnetz.de> (raw)
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
reply other threads:[~2013-12-07 8:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386405921-18219-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=aliguori@amazon.com \
--cc=andreas.faerber@web.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).