commit c53da9aa5bffd4822fdf414cd8f930e45659b028
parent e7a420eca70a3dd651e5795de537b6a297546b10
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 5 Jan 2021 11:49:03 +0100
tweaks: fold some conditions into bitwise masks, for efficiency
Diffstat:
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/help.c b/src/help.c
@@ -50,7 +50,7 @@ void help_init(void)
char *ptr;
/* First, set up the initial help text for the current function. */
- if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) {
+ if (currmenu & (MWHEREIS|MREPLACE|MREPLACEWITH)) {
htx[0] = N_("Search Command Help Text\n\n "
"Enter the words or characters you would like to "
"search for, and then press Enter. If there is a "
@@ -551,7 +551,7 @@ void show_help(void)
}
#ifdef ENABLE_BROWSER
- if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
+ if (oldmenu & (MBROWSER|MWHEREISFILE|MGOTODIR))
browser_refresh();
else
#endif
@@ -569,7 +569,7 @@ void do_help(void)
#ifdef ENABLE_HELP
show_help();
#else
- if (currmenu == MMAIN || currmenu == MBROWSER)
+ if (currmenu & (MMAIN|MBROWSER))
statusbar(_("^W = Ctrl+W M-W = Alt+W"));
else
beep();
diff --git a/src/prompt.c b/src/prompt.c
@@ -496,8 +496,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
} else
#endif
/* Allow tab completion of filenames, but not in restricted mode. */
- if ((currmenu == MINSERTFILE || currmenu == MWRITEFILE ||
- currmenu == MGOTODIR) && !ISSET(RESTRICTED))
+ if ((currmenu & (MINSERTFILE|MWRITEFILE|MGOTODIR)) && !ISSET(RESTRICTED))
answer = input_tab(answer, &typing_x, refresh_func, listed);
} else
#endif /* ENABLE_TABCOMP */
diff --git a/src/winio.c b/src/winio.c
@@ -3398,7 +3398,7 @@ void full_refresh(void)
* of the edit window (when not in the file browser), and the bottom bars. */
void draw_all_subwindows(void)
{
- if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
+ if (currmenu & ~(MBROWSER|MWHEREISFILE|MGOTODIR))
titlebar(title);
#ifdef ENABLE_HELP
if (inhelp) {
@@ -3406,7 +3406,7 @@ void draw_all_subwindows(void)
wrap_help_text_into_buffer();
} else
#endif
- if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
+ if (currmenu & ~(MBROWSER|MWHEREISFILE|MGOTODIR))
edit_refresh();
bottombars(currmenu);
}