Received: from eggs.gnu.org ([2001:4830:134:3::10]:35338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vwfqf-0008PH-KG for qemu-devel@nongnu.org; Fri, 27 Dec 2013 17:25:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwfqX-0000LY-A6 for qemu-devel@nongnu.org; Fri, 27 Dec 2013 17:25:41 -0500 From: Michael Tokarev Date: Sat, 28 Dec 2013 02:07:17 +0400 Message-Id: <1388182050-10270-5-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1388182050-10270-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1388182050-10270-1-git-send-email-mjt@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 04/17] ui/cocoa: Use macro ARRAY_SIZE where possible List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@amazon.com Cc: qemu-trivial@nongnu.org, Stefan Weil , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Michael Tokarev , qemu-devel@nongnu.org From: Stefan Weil This improves readability and simplifies the code. Cc: Andreas F=C3=A4rber Cc: Anthony Liguori Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- 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[] =3D =20 static int cocoa_keycode_to_qemu(int keycode) { - if((sizeof(keymap)/sizeof(int)) <=3D keycode) - { - printf("(cocoa) warning unknow keycode 0x%x\n", keycode); + if (ARRAY_SIZE(keymap) <=3D keycode) { + printf("(cocoa) warning unknown keycode 0x%x\n", keycode); return 0; } return keymap[keycode]; --=20 1.7.10.4