nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit fd0589d8bca2154c9f2d33e68b6fe044d6a3dff7
parent a381021ffc3cbfdf7729dbd619d96307d6b2e374
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon,  2 Jan 2017 21:12:44 +0100

tweaks: remove the cluttering conditional compilation of a parameter

The conditionalizing saved negligible amounts of space, of memory, and
of speed.

Diffstat:
Msrc/browser.c | 12++----------
Msrc/files.c | 10++--------
Msrc/prompt.c | 14++------------
Msrc/proto.h | 5+----
Msrc/search.c | 18++++--------------
Msrc/text.c | 6+-----
6 files changed, 12 insertions(+), 53 deletions(-)

diff --git 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 @@ -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 @@ -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, ":<aa>". */ 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 @@ -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 @@ -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 @@ -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