Commit 9322e1e6 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: reshuffle two ifs for a little more speed

Saving roughly twenty microseconds at startup.
No related merge requests found
Showing with 7 additions and 8 deletions
+7 -8
......@@ -406,18 +406,17 @@ void assign_keyinfo(sc *s, const char *keystring)
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
if (keystring[0] == '^')
if (keystring[0] == '^') {
s->keycode = s->keystr[1] - 64;
else if (s->meta)
if (strcasecmp(keystring, "^Space") == 0)
s->keycode = 0;
} else if (s->meta) {
s->keycode = tolower((int) s->keystr[2]);
else if (keystring[0] == 'F')
if (strcasecmp(keystring, "M-Space") == 0)
s->keycode = (int)' ';
} else if (keystring[0] == 'F')
s->keycode = KEY_F0 + atoi(&s->keystr[1]);
/* Catch the strings that don't bind as easily as we'd like. */
if (strcasecmp(s->keystr, "^Space") == 0)
s->keycode = 0;
else if (strcasecmp(s->keystr, "M-Space") == 0)
s->keycode = (int) ' ';
else if (!strcasecmp(s->keystr, "Up"))
s->keycode = KEY_UP;
else if (!strcasecmp(s->keystr, "Down"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment