input: write a few ifs more compactly
parent
05238f31f4
commit
e666f8c50d
15
src/winio.c
15
src/winio.c
|
@ -250,21 +250,16 @@ void unget_kbinput(int kbinput, bool metakey, bool funckey)
|
||||||
/* Try to read input_len characters from the keystroke buffer. If the
|
/* Try to read input_len characters from the keystroke buffer. If the
|
||||||
* keystroke buffer is empty and win isn't NULL, try to read in more
|
* keystroke buffer is empty and win isn't NULL, try to read in more
|
||||||
* characters from win and add them to the keystroke buffer before doing
|
* characters from win and add them to the keystroke buffer before doing
|
||||||
* anything else. If the keystroke buffer is empty and win is NULL,
|
* anything else. If the keystroke buffer is (still) empty, return NULL. */
|
||||||
* return NULL. */
|
|
||||||
int *get_input(WINDOW *win, size_t input_len)
|
int *get_input(WINDOW *win, size_t input_len)
|
||||||
{
|
{
|
||||||
int *input;
|
int *input;
|
||||||
|
|
||||||
if (key_buffer_len == 0) {
|
if (key_buffer_len == 0 && win != NULL)
|
||||||
if (win != NULL) {
|
get_key_buffer(win);
|
||||||
get_key_buffer(win);
|
|
||||||
|
|
||||||
if (key_buffer_len == 0)
|
if (key_buffer_len == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If input_len is greater than the length of the keystroke buffer,
|
/* If input_len is greater than the length of the keystroke buffer,
|
||||||
* only read the number of characters in the keystroke buffer. */
|
* only read the number of characters in the keystroke buffer. */
|
||||||
|
|
Loading…
Reference in New Issue