commit 30aaea2d04256470e27259acdf6ac507a1840d6a
parent d0cb64650b3ba0441e3b46166b0ea99a54d104b5
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 10 Jul 2021 15:56:38 +0200
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".
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -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"),