From 4e5ea183946757d0b5154be9d755b64c9bc529c3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 12 Apr 2015 09:04:30 +0000 Subject: [PATCH] Removing an unused variable, and adjusting the introductory comment for the recently tweaked logic. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/browser.c | 20 +++++--------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index b30c710b..448e93a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ * src/global.c (shortcut_init): Rebind ^Y and ^V in the WhereisFile menu from the pointless page_up() and page_down() to the effective first_file() and last_file(). Also unbind some other useless keys. + * src/browser.c (filesearch_init): Remove an unused variable, and + adjust the introductory comment for the recently tweaked logic. 2015-04-11 Benno Schulenberg * src/search.c (do_replace_loop): Do not split off the marked region diff --git a/src/browser.c b/src/browser.c index bdd108c6..66d93a5a 100644 --- a/src/browser.c +++ b/src/browser.c @@ -697,20 +697,14 @@ void browser_select_dirname(const char *needle) } } -/* Set up the system variables for a filename search. Return -1 if the - * search should be canceled (due to Cancel, a blank search string, or a - * failed regcomp()), return 0 on success, and return 1 on rerun calling - * program. */ +/* Set up the system variables for a filename search. Return -1 or -2 if + * the search should be canceled (due to Cancel or a blank search string), + * return 0 when we have a string, and return a positive value when some + * function was run. */ int filesearch_init(void) { int input; char *buf; - static char *backupstring = NULL; - /* The search string we'll be using. */ - - /* If backupstring doesn't exist, initialize it to "". */ - if (backupstring == NULL) - backupstring = mallocstrcpy(NULL, ""); if (last_search == NULL) last_search = mallocstrcpy(NULL, ""); @@ -731,7 +725,7 @@ int filesearch_init(void) #ifndef DISABLE_TABCOMP TRUE, #endif - MWHEREISFILE, backupstring, + MWHEREISFILE, NULL, #ifndef DISABLE_HISTORIES &search_history, #endif @@ -740,9 +734,6 @@ int filesearch_init(void) /* Release buf now that we don't need it anymore. */ free(buf); - free(backupstring); - backupstring = NULL; - /* If only Enter was pressed but we have a previous string, it's okay. */ if (input == -2 && *last_search != '\0') return 0; @@ -751,7 +742,6 @@ int filesearch_init(void) if (input < 0) statusbar(_("Cancelled")); - /* Zero is good; positive values mean some function was run. */ return input; }