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.master
parent
070c9c60ec
commit
fee905a34a
11
src/text.c
11
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;
|
||||
|
|
Loading…
Reference in New Issue