tweaks: weld two fragments together, twice, by eliding an unneeded 'if'

The get_kbinput() routine will never return ERR, so there is no need
to check for that.
master
Benno Schulenberg 2020-02-12 11:46:15 +01:00
parent 0a31a9aa38
commit 0ed62e84de
2 changed files with 4 additions and 19 deletions

View File

@ -1531,17 +1531,9 @@ void do_input(void)
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (shortcut == NULL) {
if (input < 0x20 || input > 0xFF || meta_key) {
if (input < 0x20 || input > 0xFF || meta_key)
unbound_key(input);
input = ERR;
}
}
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
* character: add the character to the input buffer -- or display a
* warning when we're in view mode. */
if (input != ERR && shortcut == NULL) {
if (ISSET(VIEW_MODE))
else if (ISSET(VIEW_MODE))
print_view_warning();
else {
/* Store the byte, and leave room for a terminating zero. */

View File

@ -90,18 +90,11 @@ int do_statusbar_input(bool *finished)
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if (shortcut == NULL) {
if (input < 0x20 || input > 0xFF || meta_key) {
if (input < 0x20 || input > 0xFF || meta_key)
beep();
input = ERR;
}
}
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
* character: add the it to the input buffer, when allowed. */
if (input != ERR && shortcut == NULL) {
/* Only accept input when not in restricted mode, or when not at
* the "Write File" prompt, or when there is no filename yet. */
if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
else if (!ISSET(RESTRICTED) || currmenu != MWRITEFILE ||
openfile->filename[0] == '\0') {
kbinput_len++;
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));