From fd0589d8bca2154c9f2d33e68b6fe044d6a3dff7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 2 Jan 2017 21:12:44 +0100 Subject: [PATCH] tweaks: remove the cluttering conditional compilation of a parameter The conditionalizing saved negligible amounts of space, of memory, and of speed. --- src/browser.c | 12 ++---------- src/files.c | 10 ++-------- src/prompt.c | 14 ++------------ src/proto.h | 5 +---- src/search.c | 18 ++++-------------- src/text.c | 6 +----- 6 files changed, 12 insertions(+), 53 deletions(-) diff --git a/src/browser.c b/src/browser.c index 3c8191cf..4605ff8d 100644 --- a/src/browser.c +++ b/src/browser.c @@ -219,11 +219,7 @@ char *do_browser(char *path) selected = filelist_len - 1; } else if (func == goto_dir_void) { /* Ask for the directory to go to. */ - int i = do_prompt(TRUE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif - MGOTODIR, NULL, + int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL, #ifndef DISABLE_HISTORIES NULL, #endif @@ -670,11 +666,7 @@ int filesearch_init(void) buf = mallocstrcpy(NULL, ""); /* This is now one simple call. It just does a lot. */ - input = do_prompt(FALSE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif - MWHEREISFILE, NULL, + input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, #ifndef DISABLE_HISTORIES &search_history, #endif diff --git a/src/files.c b/src/files.c index 9b14ef99..b1c5f5ad 100644 --- a/src/files.c +++ b/src/files.c @@ -1087,10 +1087,7 @@ void do_insertfile(void) present_path = mallocstrcpy(present_path, "./"); - i = do_prompt(TRUE, -#ifndef DISABLE_TABCOMP - TRUE, -#endif + i = do_prompt(TRUE, TRUE, #ifndef NANO_TINY execute ? MEXTCMD : #endif @@ -2224,10 +2221,7 @@ int do_writeout(bool exiting) /* If we're using restricted mode, and the filename isn't blank, * disable tab completion. */ i = do_prompt(!ISSET(RESTRICTED) || openfile->filename[0] == '\0', -#ifndef DISABLE_TABCOMP - TRUE, -#endif - MWRITEFILE, given, + TRUE, MWRITEFILE, given, #ifndef DISABLE_HISTORIES NULL, #endif diff --git a/src/prompt.c b/src/prompt.c index 0bb6daba..8dceece0 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -433,9 +433,7 @@ void update_the_statusbar(void) /* Get a string of input at the statusbar prompt. */ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, -#ifndef DISABLE_TABCOMP bool allow_files, bool *listed, -#endif #ifndef DISABLE_HISTORIES filestruct **history_list, #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 * interpreted. The allow_files parameter indicates whether we should * allow all files (as opposed to just directories) to be tab completed. */ -int do_prompt(bool allow_tabs, -#ifndef DISABLE_TABCOMP - bool allow_files, -#endif +int do_prompt(bool allow_tabs, bool allow_files, int menu, const char *curranswer, #ifndef DISABLE_HISTORIES filestruct **history_list, @@ -626,9 +621,7 @@ int do_prompt(bool allow_tabs, va_list ap; int retval; functionptrtype func = NULL; -#ifndef DISABLE_TABCOMP bool listed = FALSE; -#endif /* Save a possible current statusbar x position. */ 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, ":". */ null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)); - func = acquire_an_answer(&retval, allow_tabs, -#ifndef DISABLE_TABCOMP - allow_files, &listed, -#endif + func = acquire_an_answer(&retval, allow_tabs, allow_files, &listed, #ifndef DISABLE_HISTORIES history_list, #endif diff --git a/src/proto.h b/src/proto.h index 6aca349d..126295ff 100644 --- a/src/proto.h +++ b/src/proto.h @@ -503,10 +503,7 @@ size_t get_statusbar_page_start(size_t start_col, size_t column); void reinit_statusbar_x(void); void reset_statusbar_cursor(void); void update_the_statusbar(void); -int do_prompt(bool allow_tabs, -#ifndef DISABLE_TABCOMP - bool allow_files, -#endif +int do_prompt(bool allow_tabs, bool allow_files, int menu, const char *curranswer, #ifndef DISABLE_HISTORIES filestruct **history_list, diff --git a/src/search.c b/src/search.c index e11da9ef..9b67997e 100644 --- a/src/search.c +++ b/src/search.c @@ -147,10 +147,7 @@ int search_init(bool replacing, bool use_answer) buf = mallocstrcpy(NULL, ""); /* This is now one simple call. It just does a lot. */ - i = do_prompt(FALSE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif + i = do_prompt(FALSE, FALSE, replacing ? MREPLACE : MWHEREIS, backupstring, #ifndef DISABLE_HISTORIES &search_history, @@ -785,11 +782,7 @@ void do_replace(void) if (i != 0) return; - i = do_prompt(FALSE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif - MREPLACEWITH, NULL, + i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, #ifndef DISABLE_HISTORIES &replace_history, #endif @@ -854,11 +847,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, functionptrtype func; /* Ask for the line and column. */ - int i = do_prompt(FALSE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif - MGOTOLINE, use_answer ? answer : NULL, + int i = do_prompt(FALSE, FALSE, MGOTOLINE, + use_answer ? answer : NULL, #ifndef DISABLE_HISTORIES NULL, #endif diff --git a/src/text.c b/src/text.c index e7b9b083..2c9e5f51 100644 --- a/src/text.c +++ b/src/text.c @@ -2664,11 +2664,7 @@ bool do_int_spell_fix(const char *word) spotlight(TRUE, exp_word); /* Let the user supply a correctly spelled alternative. */ - proceed = (do_prompt(FALSE, -#ifndef DISABLE_TABCOMP - FALSE, -#endif - MSPELL, word, + proceed = (do_prompt(FALSE, FALSE, MSPELL, word, #ifndef DISABLE_HISTORIES NULL, #endif