From 37fd348a1de7b2a8cbabc023297e29f9c696daf8 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 7 Apr 2015 10:41:00 +0000 Subject: [PATCH] Eliding a miniscule function, and renaming a variable for clarity. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/browser.c | 19 ++++++------------- src/proto.h | 1 - 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index acd6e06c..f3121328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ (there are no toggles here) and tweak some others. * src/search.c (do_search, do_research): Use the same variable as in the surrounding code, for consistency. + * src/browser.c (findnextfile_wrap_reset): Elide this function, + and rename 'search_last_file' to 'came_full_circle'. 2015-04-05 Benno Schulenberg * doc/texinfo/nano.texi: Expand on nano's features, condense the diff --git a/src/browser.c b/src/browser.c index b3d1fc6c..4fe2269c 100644 --- a/src/browser.c +++ b/src/browser.c @@ -41,8 +41,8 @@ static int longest = 0; static size_t selected = 0; /* The currently selected filename in the list. This variable * is zero-based. */ -static bool search_last_file = FALSE; - /* Have we gone past the last file while searching? */ +static bool came_full_circle = FALSE; + /* Have we reached the starting file again while searching? */ /* Our main file browser function. path is the tilde-expanded path we * start browsing from. */ @@ -787,7 +787,7 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle) if (found != NULL && (!no_sameline || currselected != begin)) break; - if (search_last_file) { + if (came_full_circle) { /* We've finished processing the filenames, so get out. */ not_found_msg(needle); return FALSE; @@ -804,7 +804,7 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle) if (currselected == begin) /* We've reached the original starting file. */ - search_last_file = TRUE; + came_full_circle = TRUE; filetail = tail(filelist[currselected]); @@ -817,13 +817,6 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle) return TRUE; } -/* Clear the flag indicating that a search reached the last file in the - * list. We need to do this just before a new search. */ -void findnextfile_wrap_reset(void) -{ - search_last_file = FALSE; -} - /* Abort the current filename search. Clean up by setting the current * shortcut list to the browser shortcut list, and displaying it. */ void filesearch_abort(void) @@ -861,7 +854,7 @@ void do_filesearch(void) update_history(&search_history, answer); #endif - findnextfile_wrap_reset(); + came_full_circle = FALSE; didfind = findnextfile(FALSE, begin, answer); /* Check to see if there's only one occurrence of the string and @@ -887,7 +880,7 @@ void do_fileresearch(void) search_init_globals(); if (last_search[0] != '\0') { - findnextfile_wrap_reset(); + came_full_circle = FALSE; didfind = findnextfile(FALSE, begin, last_search); /* Check to see if there's only one occurrence of the string and diff --git a/src/proto.h b/src/proto.h index f8c8841e..7369ba66 100644 --- a/src/proto.h +++ b/src/proto.h @@ -152,7 +152,6 @@ void browser_refresh(void); bool browser_select_filename(const char *needle); int filesearch_init(void); bool findnextfile(bool no_sameline, size_t begin, const char *needle); -void findnextfile_wrap_reset(void); void filesearch_abort(void); void do_filesearch(void); void do_fileresearch(void); -- 2.39.5