tweaks: rename a variable and flip its logic, to avoid two negations

Plus, it makes more sense to start in the state "not saved" than in
the state "failed".
This commit is contained in:
Benno Schulenberg 2021-07-10 15:56:38 +02:00
parent d0cb64650b
commit 30aaea2d04

View File

@ -313,7 +313,7 @@ void do_exit(void)
* for a nameless buffer). If needed, the name is modified to be unique. */
void emergency_save(const char *plainname)
{
bool failed = TRUE;
bool saved = FALSE;
char *targetname;
if (*plainname == '\0')
@ -322,9 +322,9 @@ void emergency_save(const char *plainname)
targetname = get_next_filename(plainname, ".save");
if (*targetname != '\0')
failed = !write_file(targetname, NULL, TRUE, OVERWRITE, FALSE);
saved = write_file(targetname, NULL, TRUE, OVERWRITE, FALSE);
if (!failed)
if (saved)
fprintf(stderr, _("\nBuffer written to %s\n"), targetname);
else if (*targetname != '\0')
fprintf(stderr, _("\nBuffer not written to %s: %s\n"),