diff options
author | Kay Sievers <kay@yik.fritz.box> | 2013-08-14 13:01:53 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-08-14 15:47:48 +0200 |
commit | d22065f810a32ebea8ba15668daa6df3ddc602ca (patch) | |
tree | 92e2cc1f0e753e9aee180d1cb189b82a757c1c2b | |
parent | 0170f6ae9b0fa8b5cfbc53664067958ea834af25 (diff) |
simplify hotkey search loop
-rw-r--r-- | src/efi/gummiboot.c | 25 |
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; } |