commit 51743233ed533d8a208179565f17a366df575de6
parent 108fe330d330389343e2f56b28dbc47ddc4713cd
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 28 Mar 2016 19:14:33 +0000
Removing the 'last_replace' variable that is never used.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5768 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
6 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -4,6 +4,7 @@
main loop. This prevents a segfault when trying to open a directory.
* src/search.c (findnextstr): Provide feedback when searching takes
longer than roughly half a second (on average).
+ * src/*.c: Remove the 'last_replace' variable that is never used.
2016-03-23 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (findnextstr): Prevent the internal spell checker from
diff --git a/src/global.c b/src/global.c
@@ -57,8 +57,6 @@ ssize_t wrap_at = -CHARS_FROM_EOL;
char *last_search = NULL;
/* The last string we searched for. */
-char *last_replace = NULL;
- /* The last replacement string we searched for. */
unsigned flags[4] = {0, 0, 0, 0};
/* Our flag containing the states of all global options. */
@@ -1650,7 +1648,6 @@ void thanks_for_all_the_fish(void)
#endif
free(answer);
free(last_search);
- free(last_replace);
#ifndef DISABLE_SPELLER
free(alt_speller);
#endif
diff --git a/src/nano.c b/src/nano.c
@@ -2479,9 +2479,8 @@ int main(int argc, char **argv)
}
#endif /* !NANO_TINY */
- /* Initialize the search and replace strings. */
+ /* Initialize the search string. */
last_search = mallocstrcpy(NULL, "");
- last_replace = mallocstrcpy(NULL, "");
/* If tabsize wasn't specified, set its default value. */
if (tabsize == -1)
diff --git a/src/proto.h b/src/proto.h
@@ -46,7 +46,6 @@ extern ssize_t wrap_at;
#endif
extern char *last_search;
-extern char *last_replace;
extern unsigned flags[4];
extern WINDOW *topwin;
diff --git a/src/search.c b/src/search.c
@@ -518,7 +518,7 @@ void go_looking(void)
* text in the passed string only when create is TRUE. */
int replace_regexp(char *string, bool create)
{
- const char *c = last_replace;
+ const char *c = answer;
size_t replacement_size = 0;
/* Iterate through the replacement text to handle subexpression
@@ -850,8 +850,6 @@ void do_replace(void)
return;
}
- last_replace = mallocstrcpy(last_replace, answer);
-
/* Save where we are. */
edittop_save = openfile->edittop;
begin = openfile->current;
diff --git a/src/text.c b/src/text.c
@@ -2352,7 +2352,7 @@ void do_full_justify(void)
* return FALSE if the user cancels. */
bool do_int_spell_fix(const char *word)
{
- char *save_search, *save_replace;
+ char *save_search;
size_t match_len, current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
filestruct *edittop_save = openfile->edittop;
@@ -2388,13 +2388,9 @@ bool do_int_spell_fix(const char *word)
UNSET(USE_REGEXP);
#endif
- /* Save the current search/replace strings. */
+ /* Save the current search string, then set it to the misspelled word. */
save_search = last_search;
- save_replace = last_replace;
-
- /* Set the search/replace strings to the misspelled word. */
last_search = mallocstrcpy(NULL, word);
- last_replace = mallocstrcpy(NULL, word);
focusing = TRUE;
@@ -2484,11 +2480,9 @@ bool do_int_spell_fix(const char *word)
}
#endif /* !NANO_TINY */
- /* Restore the search/replace strings. */
+ /* Restore the string that was last searched for. */
free(last_search);
last_search = save_search;
- free(last_replace);
- last_replace = save_replace;
/* Restore where we were. */
openfile->edittop = edittop_save;