nano

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

commit fee905a34a7d9e3373068fb613a5ed6bcfbe7cdb
parent 070c9c60ecc273b8f2539946f3580c770272be7f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 25 Aug 2020 11:51:54 +0200

tweaks: drop the unneeded saving and restoring of a global variable

The two functions findnextstr() and do_replace_loop() do not change
or even touch 'last_search', so there is no need to save and then
restore its value when doing corrections of misspelled words.

Diffstat:
Msrc/text.c | 11-----------
1 file changed, 0 insertions(+), 11 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -2212,7 +2212,6 @@ void treat(char *tempfile_name, char *theprogram, bool spelling) /* Let the user edit the misspelled word. Return FALSE if the user cancels. */ bool fix_spello(const char *word) { - char *save_search; size_t firstcolumn_save = openfile->firstcolumn; size_t current_x_save = openfile->current_x; linestruct *edittop_save = openfile->edittop; @@ -2226,13 +2225,7 @@ bool fix_spello(const char *word) linestruct *top, *bot; size_t top_x, bot_x; bool right_side_up = (openfile->mark && mark_is_before_cursor()); -#endif - - /* Save the current search string, then set it to the misspelled word. */ - save_search = last_search; - last_search = copy_of(word); -#ifndef NANO_TINY /* If the mark is on, start at the beginning of the marked region. */ if (openfile->mark) { get_region(&top, &top_x, &bot, &bot_x); @@ -2314,10 +2307,6 @@ bool fix_spello(const char *word) openfile->current_x = current_x_save; } - /* Restore the string that was last searched for. */ - free(last_search); - last_search = save_search; - /* Restore the viewport to where it was. */ openfile->edittop = edittop_save; openfile->firstcolumn = firstcolumn_save;