From b8a47f4e37eafd5e3340f80f6794b8559e7943f3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 20 Mar 2016 16:19:30 +0000 Subject: [PATCH] Not bothering to set 'answer'; just using 'last_search', which has already been set to 'answer' in search_init() when 'answer' isn't empty, and when 'answer' /is/ empty we use 'last_search' anyway. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5755 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/search.c | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c0c01a7..8df3898d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ * src/files.c (do_writeout): When the name of the file was changed, always ask whether this is okay. This fixes Savannah bug #46894. * src/search.c (do_research): Use 'return' instead of 'else'. + * src/search.c (do_search): Don't bother setting 'answer'; just use + 'last_search', which has been set to 'answer' in search_init(). 2016-03-19 Benno Schulenberg * src/search.c (search_init): Always remember the last typed string, diff --git a/src/search.c b/src/search.c index e7334396..32b00e99 100644 --- a/src/search.c +++ b/src/search.c @@ -434,16 +434,12 @@ void do_search(void) if (i != 0) return; - /* If answer is empty, use what was last searched for. */ - if (*answer == '\0') - answer = mallocstrcpy(answer, last_search); - findnextstr_wrap_reset(); didfind = findnextstr( #ifndef DISABLE_SPELLER FALSE, #endif - openfile->current, openfile->current_x, answer, NULL); + openfile->current, openfile->current_x, last_search, NULL); /* If we found something, and we're back at the exact same spot where * we started searching, then this is the only occurrence. */ -- 2.39.5