From d087d797f0a9aa7bb8cc5276b031260679f29707 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Mon, 20 Jan 2020 09:17:03 -0400 Subject: [PATCH] use while not for match special key map --- key/keycode_c.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/key/keycode_c.h b/key/keycode_c.h index e1e76c1..cb19f51 100644 --- a/key/keycode_c.h +++ b/key/keycode_c.h @@ -115,14 +115,13 @@ MMKeyCode keyCodeForChar(const char c){ /* Some special keys are apparently not handled properly by * XStringToKeysym() on some systems, so search for them instead in our * mapping table. */ - size_t i; - const size_t specialCharacterCount = - sizeof(XSpecialCharacterTable) / sizeof(XSpecialCharacterTable[0]); - for (i = 0; i < specialCharacterCount; ++i) { - if (c == XSpecialCharacterTable[i].name) { - code = XSpecialCharacterTable[i].code; + struct XSpecialCharacterMapping* xs = XSpecialCharacterTable; + while (xs->name) { + if (c == xs->name ) { + code = xs->code; break; } + xs++; } }