summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 041007f)
raw | patch | inline | side by side (parent: 041007f)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 21 Dec 2011 20:40:52 +0000 (21:40 +0100) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 21 Dec 2011 20:59:29 +0000 (21:59 +0100) |
The performance penalty shouldn't be too high (loop unrolling could
help here).
help here).
src/command.c | patch | blob | history |
diff --git a/src/command.c b/src/command.c
index af6afd15a01ee7e93ab01a31e72cfa6a4f301e2d..76e84dc1c897c244335454d1dc7cf4078e9e9c81 100644 (file)
--- a/src/command.c
+++ b/src/command.c
assert(c != NULL);
for (int i = 0; c[i].name; i++) {
- if (c[i].keys[0] == key ||
- c[i].keys[1] == key ||
- c[i].keys[2] == key)
- return c[i].command;
+ for (int j = 0; j < MAX_COMMAND_KEYS; j++)
+ if (c[i].keys[j] == key)
+ return c[i].command;
}
return CMD_NONE;