tweaks: fold some conditions into bitwise masks, for efficiency

master
Benno Schulenberg 2021-01-05 11:49:03 +01:00
parent e7a420eca7
commit c53da9aa5b
3 changed files with 6 additions and 7 deletions

View File

@ -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();

View File

@ -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 */

View File

@ -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);
}