tweaks: remove the cluttering conditional compilation of a parameter

The conditionalizing saved negligible amounts of space, of memory, and
of speed.
master
Benno Schulenberg 2017-01-02 21:12:44 +01:00
parent a381021ffc
commit fd0589d8bc
6 changed files with 12 additions and 53 deletions

View File

@ -219,11 +219,7 @@ char *do_browser(char *path)
selected = filelist_len - 1; selected = filelist_len - 1;
} else if (func == goto_dir_void) { } else if (func == goto_dir_void) {
/* Ask for the directory to go to. */ /* Ask for the directory to go to. */
int i = do_prompt(TRUE, int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
MGOTODIR, NULL,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif
@ -670,11 +666,7 @@ int filesearch_init(void)
buf = mallocstrcpy(NULL, ""); buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */ /* This is now one simple call. It just does a lot. */
input = do_prompt(FALSE, input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
MWHEREISFILE, NULL,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
&search_history, &search_history,
#endif #endif

View File

@ -1087,10 +1087,7 @@ void do_insertfile(void)
present_path = mallocstrcpy(present_path, "./"); present_path = mallocstrcpy(present_path, "./");
i = do_prompt(TRUE, i = do_prompt(TRUE, TRUE,
#ifndef DISABLE_TABCOMP
TRUE,
#endif
#ifndef NANO_TINY #ifndef NANO_TINY
execute ? MEXTCMD : execute ? MEXTCMD :
#endif #endif
@ -2224,10 +2221,7 @@ int do_writeout(bool exiting)
/* If we're using restricted mode, and the filename isn't blank, /* If we're using restricted mode, and the filename isn't blank,
* disable tab completion. */ * disable tab completion. */
i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0', i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0',
#ifndef DISABLE_TABCOMP TRUE, MWRITEFILE, given,
TRUE,
#endif
MWRITEFILE, given,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif

View File

@ -433,9 +433,7 @@ void update_the_statusbar(void)
/* Get a string of input at the statusbar prompt. */ /* Get a string of input at the statusbar prompt. */
functionptrtype acquire_an_answer(int *actual, bool allow_tabs, functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool allow_files, bool *listed, bool allow_files, bool *listed,
#endif
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
filestruct **history_list, filestruct **history_list,
#endif #endif
@ -613,10 +611,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
* The allow_tabs parameter indicates whether we should allow tabs to be * The allow_tabs parameter indicates whether we should allow tabs to be
* interpreted. The allow_files parameter indicates whether we should * interpreted. The allow_files parameter indicates whether we should
* allow all files (as opposed to just directories) to be tab completed. */ * allow all files (as opposed to just directories) to be tab completed. */
int do_prompt(bool allow_tabs, int do_prompt(bool allow_tabs, bool allow_files,
#ifndef DISABLE_TABCOMP
bool allow_files,
#endif
int menu, const char *curranswer, int menu, const char *curranswer,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
filestruct **history_list, filestruct **history_list,
@ -626,9 +621,7 @@ int do_prompt(bool allow_tabs,
va_list ap; va_list ap;
int retval; int retval;
functionptrtype func = NULL; functionptrtype func = NULL;
#ifndef DISABLE_TABCOMP
bool listed = FALSE; bool listed = FALSE;
#endif
/* Save a possible current statusbar x position. */ /* Save a possible current statusbar x position. */
size_t was_statusbar_x = statusbar_x; size_t was_statusbar_x = statusbar_x;
@ -646,10 +639,7 @@ int do_prompt(bool allow_tabs,
/* Reserve five columns for colon plus angles plus answer, ":<aa>". */ /* Reserve five columns for colon plus angles plus answer, ":<aa>". */
null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)); null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5));
func = acquire_an_answer(&retval, allow_tabs, func = acquire_an_answer(&retval, allow_tabs, allow_files, &listed,
#ifndef DISABLE_TABCOMP
allow_files, &listed,
#endif
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
history_list, history_list,
#endif #endif

View File

@ -503,10 +503,7 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
void reinit_statusbar_x(void); void reinit_statusbar_x(void);
void reset_statusbar_cursor(void); void reset_statusbar_cursor(void);
void update_the_statusbar(void); void update_the_statusbar(void);
int do_prompt(bool allow_tabs, int do_prompt(bool allow_tabs, bool allow_files,
#ifndef DISABLE_TABCOMP
bool allow_files,
#endif
int menu, const char *curranswer, int menu, const char *curranswer,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
filestruct **history_list, filestruct **history_list,

View File

@ -147,10 +147,7 @@ int search_init(bool replacing, bool use_answer)
buf = mallocstrcpy(NULL, ""); buf = mallocstrcpy(NULL, "");
/* This is now one simple call. It just does a lot. */ /* This is now one simple call. It just does a lot. */
i = do_prompt(FALSE, i = do_prompt(FALSE, FALSE,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
replacing ? MREPLACE : MWHEREIS, backupstring, replacing ? MREPLACE : MWHEREIS, backupstring,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
&search_history, &search_history,
@ -785,11 +782,7 @@ void do_replace(void)
if (i != 0) if (i != 0)
return; return;
i = do_prompt(FALSE, i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
MREPLACEWITH, NULL,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
&replace_history, &replace_history,
#endif #endif
@ -854,11 +847,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
functionptrtype func; functionptrtype func;
/* Ask for the line and column. */ /* Ask for the line and column. */
int i = do_prompt(FALSE, int i = do_prompt(FALSE, FALSE, MGOTOLINE,
#ifndef DISABLE_TABCOMP use_answer ? answer : NULL,
FALSE,
#endif
MGOTOLINE, use_answer ? answer : NULL,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif

View File

@ -2664,11 +2664,7 @@ bool do_int_spell_fix(const char *word)
spotlight(TRUE, exp_word); spotlight(TRUE, exp_word);
/* Let the user supply a correctly spelled alternative. */ /* Let the user supply a correctly spelled alternative. */
proceed = (do_prompt(FALSE, proceed = (do_prompt(FALSE, FALSE, MSPELL, word,
#ifndef DISABLE_TABCOMP
FALSE,
#endif
MSPELL, word,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif