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; char *ptr;
/* First, set up the initial help text for the current function. */ /* 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 " htx[0] = N_("Search Command Help Text\n\n "
"Enter the words or characters you would like to " "Enter the words or characters you would like to "
"search for, and then press Enter. If there is a " "search for, and then press Enter. If there is a "
@ -551,7 +551,7 @@ void show_help(void)
} }
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR) if (oldmenu & (MBROWSER|MWHEREISFILE|MGOTODIR))
browser_refresh(); browser_refresh();
else else
#endif #endif
@ -569,7 +569,7 @@ void do_help(void)
#ifdef ENABLE_HELP #ifdef ENABLE_HELP
show_help(); show_help();
#else #else
if (currmenu == MMAIN || currmenu == MBROWSER) if (currmenu & (MMAIN|MBROWSER))
statusbar(_("^W = Ctrl+W M-W = Alt+W")); statusbar(_("^W = Ctrl+W M-W = Alt+W"));
else else
beep(); beep();

View File

@ -496,8 +496,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed,
} else } else
#endif #endif
/* Allow tab completion of filenames, but not in restricted mode. */ /* Allow tab completion of filenames, but not in restricted mode. */
if ((currmenu == MINSERTFILE || currmenu == MWRITEFILE || if ((currmenu & (MINSERTFILE|MWRITEFILE|MGOTODIR)) && !ISSET(RESTRICTED))
currmenu == MGOTODIR) && !ISSET(RESTRICTED))
answer = input_tab(answer, &typing_x, refresh_func, listed); answer = input_tab(answer, &typing_x, refresh_func, listed);
} else } else
#endif /* ENABLE_TABCOMP */ #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. */ * of the edit window (when not in the file browser), and the bottom bars. */
void draw_all_subwindows(void) void draw_all_subwindows(void)
{ {
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR) if (currmenu & ~(MBROWSER|MWHEREISFILE|MGOTODIR))
titlebar(title); titlebar(title);
#ifdef ENABLE_HELP #ifdef ENABLE_HELP
if (inhelp) { if (inhelp) {
@ -3406,7 +3406,7 @@ void draw_all_subwindows(void)
wrap_help_text_into_buffer(); wrap_help_text_into_buffer();
} else } else
#endif #endif
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR) if (currmenu & ~(MBROWSER|MWHEREISFILE|MGOTODIR))
edit_refresh(); edit_refresh();
bottombars(currmenu); bottombars(currmenu);
} }