summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@yik.fritz.box>2013-08-14 13:01:53 +0200
committerKay Sievers <kay@vrfy.org>2013-08-14 15:47:48 +0200
commitd22065f810a32ebea8ba15668daa6df3ddc602ca (patch)
tree92e2cc1f0e753e9aee180d1cb189b82a757c1c2b /src
parent0170f6ae9b0fa8b5cfbc53664067958ea834af25 (diff)
simplify hotkey search loop
Diffstat (limited to 'src')
-rw-r--r--src/efi/gummiboot.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c
index 22dfd6e..3ea06c6 100644
--- a/src/efi/gummiboot.c
+++ b/src/efi/gummiboot.c
@@ -617,6 +617,9 @@ static BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max, UINTN
static UINTN entry_lookup_key(Config *config, UINTN start, CHAR16 key) {
UINTN i;
+ if (key == 0)
+ return -1;
+
/* select entry by number key */
if (key >= '1' && key <= '9') {
i = key - '0';
@@ -626,23 +629,13 @@ static UINTN entry_lookup_key(Config *config, UINTN start, CHAR16 key) {
}
/* find matching key in config entries */
- for (i = start; i < config->entry_count; i++) {
- if (config->entries[i]->key == '\0')
- continue;
- if (config->entries[i]->key != key)
- continue;
-
- return i;
- }
+ for (i = start; i < config->entry_count; i++)
+ if (config->entries[i]->key == key)
+ return i;
- for (i = 0; i < start; i++) {
- if (config->entries[i]->key == '\0')
- continue;
- if (config->entries[i]->key != key)
- continue;
-
- return i;
- }
+ for (i = 0; i < start; i++)
+ if (config->entries[i]->key == key)
+ return i;
return -1;
}