tweaks: remove three unneeded while loops from two input routines

The whiles are unneeded because the result of get_input() can
never be NULL when in waiting mode -- and only when searching
for something are we NOT in waiting mode.
master
Benno Schulenberg 2020-07-21 20:33:32 +02:00
parent 3e899b15c2
commit 5ca4e9f5b3
1 changed files with 4 additions and 10 deletions

View File

@ -913,12 +913,9 @@ int parse_kbinput(WINDOW *win)
/* Read in a character. */
kbinput = get_input(win, 1);
if (kbinput == NULL && !waiting_mode)
if (kbinput == NULL)
return ERR;
while (kbinput == NULL)
kbinput = get_input(win, 1);
keycode = *kbinput;
free(kbinput);
@ -1372,13 +1369,12 @@ long assemble_unicode(int symbol)
* multibyte sequence), or 2 (for an iTerm/Eterm/rxvt double Escape). */
int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
{
int *kbinput = NULL;
int *kbinput;
reveal_cursor = TRUE;
/* Read in the first code. */
while (kbinput == NULL)
kbinput = get_input(win, 1);
kbinput = get_input(win, 1);
#ifndef NANO_TINY
/* When the window was resized, abort and return nothing. */
@ -1404,9 +1400,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
while (unicode == PROCEED) {
free(kbinput);
kbinput = NULL;
while (kbinput == NULL)
kbinput = get_input(win, 1);
kbinput = get_input(win, 1);
unicode = assemble_unicode(*kbinput);
}