commit 5ca4e9f5b3d4ecf2cf645ddca0d13aea1a3445e7
parent 3e899b15c27cf3aa9962658e487f90aabf3ecfc6
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 21 Jul 2020 20:33:32 +0200
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.
Diffstat:
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -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);
}