tweaks: elide an unneeded variable

master
Benno Schulenberg 2018-02-07 19:42:19 +01:00
parent 9ceeabda38
commit f1b5be4bbf
1 changed files with 4 additions and 6 deletions

View File

@ -96,10 +96,10 @@ void search_init(bool replacing, bool keep_the_answer)
{ {
char *thedefault; char *thedefault;
/* What will be searched for when the user typed nothing. */ /* What will be searched for when the user typed nothing. */
static char *sofar = NULL;
/* What the user has typed so far, before toggling something. */
sofar = mallocstrcpy(sofar, keep_the_answer ? answer : ""); /* When starting a new search, clear the current answer. */
if (!keep_the_answer)
answer = mallocstrcpy(answer, NULL);
/* If something was searched for earlier, include it in the prompt. */ /* If something was searched for earlier, include it in the prompt. */
if (*last_search != '\0') { if (*last_search != '\0') {
@ -118,7 +118,7 @@ void search_init(bool replacing, bool keep_the_answer)
/* Ask the user what to search for (or replace). */ /* Ask the user what to search for (or replace). */
int i = do_prompt(FALSE, FALSE, int i = do_prompt(FALSE, FALSE,
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS), inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
sofar, &search_history, answer, &search_history,
/* TRANSLATORS: This is the main search prompt. */ /* TRANSLATORS: This is the main search prompt. */
edit_refresh, "%s%s%s%s%s%s", _("Search"), edit_refresh, "%s%s%s%s%s%s", _("Search"),
/* TRANSLATORS: The next three modify the search prompt. */ /* TRANSLATORS: The next three modify the search prompt. */
@ -168,8 +168,6 @@ void search_init(bool replacing, bool keep_the_answer)
return; return;
} }
sofar = mallocstrcpy(sofar, answer);
func = func_from_key(&i); func = func_from_key(&i);
/* If we're here, one of the five toggles was pressed, or /* If we're here, one of the five toggles was pressed, or