nano

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

commit 7034c3cc4727f808259aa8eecdcf8e7024663d32
parent e30eadb4debf2548f737c06d51d7e6db1f27c754
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 11 Sep 2022 11:42:10 +0200

tweaks: drop shunting of flags by calling the needed function directly

Calling strstrwrapper() with the Backwards, Casesens, and Regex flags
unset is equivalent to calling mbstrcasestr().  So... do that instead
and quit saving and restoring the flags for each call of findfile().

This saving-and-restoring has been redundant since commit b0957254
from eight years ago.

Diffstat:
Msrc/browser.c | 15+--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/browser.c b/src/browser.c @@ -263,16 +263,6 @@ void findfile(const char *needle, bool forwards) /* The location in the file list of the filename we're looking at. */ const char *thename; /* The plain filename, without the path. */ - unsigned stash[sizeof(flags) / sizeof(flags[0])]; - /* A storage place for the current flag settings. */ - - /* Save the settings of all flags. */ - memcpy(stash, flags, sizeof(flags)); - - /* Search forward, case insensitive, and without regexes. */ - UNSET(BACKWARDS_SEARCH); - UNSET(CASE_SENSITIVE); - UNSET(USE_REGEXP); /* Step through each filename in the list until a match is found or * we've come back to the point where we started. */ @@ -294,7 +284,7 @@ void findfile(const char *needle, bool forwards) /* If the needle matches, we're done. And if we're back at the file * where we started, it is the only occurrence. */ - if (strstrwrapper(thename, needle, thename)) { + if (mbstrcasestr(thename, needle)) { if (looking_at == selected) statusbar(_("This is the only occurrence")); break; @@ -307,9 +297,6 @@ void findfile(const char *needle, bool forwards) } } - /* Restore the settings of all flags. */ - memcpy(flags, stash, sizeof(flags)); - /* Select the one we've found. */ selected = looking_at; }