tweaks: rename a variable, to indicate better what it contains

And to contrast it more with 'answer'.
master
Benno Schulenberg 2016-05-23 20:44:58 +02:00
parent 27e07d2af5
commit 286b6a9088
1 changed files with 12 additions and 11 deletions

View File

@ -1085,7 +1085,7 @@ void do_insertfile(
{ {
int i; int i;
const char *msg; const char *msg;
char *ans = mallocstrcpy(NULL, ""); char *given = mallocstrcpy(NULL, "");
/* The last answer the user typed at the statusbar prompt. */ /* The last answer the user typed at the statusbar prompt. */
filestruct *edittop_save = openfile->edittop; filestruct *edittop_save = openfile->edittop;
ssize_t was_current_lineno = openfile->current->lineno; ssize_t was_current_lineno = openfile->current->lineno;
@ -1125,7 +1125,7 @@ void do_insertfile(
#ifndef NANO_TINY #ifndef NANO_TINY
execute ? MEXTCMD : execute ? MEXTCMD :
#endif #endif
MINSERTFILE, ans, MINSERTFILE, given,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif
@ -1152,7 +1152,7 @@ void do_insertfile(
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER) #if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
functionptrtype func = func_from_key(&i); functionptrtype func = func_from_key(&i);
#endif #endif
ans = mallocstrcpy(ans, answer); given = mallocstrcpy(given, answer);
#ifndef NANO_TINY #ifndef NANO_TINY
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
@ -1341,7 +1341,8 @@ void do_insertfile(
break; break;
} }
} }
free(ans);
free(given);
} }
/* Insert a file into a new buffer or the current buffer, depending on /* Insert a file into a new buffer or the current buffer, depending on
@ -2233,8 +2234,8 @@ int do_writeout(bool exiting)
{ {
int i; int i;
append_type append = OVERWRITE; append_type append = OVERWRITE;
char *ans; char *given;
/* The last answer the user typed at the statusbar prompt. */ /* The filename we offer, or what the user typed so far. */
#ifndef DISABLE_EXTRA #ifndef DISABLE_EXTRA
static bool did_credits = FALSE; static bool did_credits = FALSE;
#endif #endif
@ -2249,7 +2250,7 @@ int do_writeout(bool exiting)
return 1; /* The write succeeded. */ return 1; /* The write succeeded. */
} }
ans = mallocstrcpy(NULL, given = mallocstrcpy(NULL,
#ifndef NANO_TINY #ifndef NANO_TINY
(!exiting && openfile->mark_set) ? "" : (!exiting && openfile->mark_set) ? "" :
#endif #endif
@ -2288,7 +2289,7 @@ int do_writeout(bool exiting)
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
TRUE, TRUE,
#endif #endif
MWRITEFILE, ans, MWRITEFILE, given,
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
NULL, NULL,
#endif #endif
@ -2317,13 +2318,13 @@ int do_writeout(bool exiting)
i = 0; i = 0;
if (i == 0) { if (i == 0) {
free(ans); free(given);
return 2; /* Yes, discard the buffer. */ return 2; /* Yes, discard the buffer. */
} else } else
continue; /* Go back to the filename prompt. */ continue; /* Go back to the filename prompt. */
} }
ans = mallocstrcpy(ans, answer); given = mallocstrcpy(given, answer);
#ifndef DISABLE_BROWSER #ifndef DISABLE_BROWSER
if (func == to_files_void) { if (func == to_files_void) {
@ -2480,7 +2481,7 @@ int do_writeout(bool exiting)
} }
} }
free(ans); free(given);
return result ? 1 : 0; return result ? 1 : 0;
} }