From a50e36c6b240bfc73a6937b8b4c0e0ad1bb829f3 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 4 Nov 2005 05:59:41 +0000 Subject: [PATCH] simplify git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3084 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/files.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/files.c b/src/files.c index e8c0bc7e..fc2c5390 100644 --- a/src/files.c +++ b/src/files.c @@ -1411,16 +1411,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type assert(openfile->fileage != NULL && openfile->filebot != NULL); while (fileptr != NULL) { - size_t data_len, size; - - /* If we're on the last line of the file and it's blank, skip - * over it, since the newline character we wrote after the - * next-to-last line of the file is equivalent to it. */ - if (fileptr == openfile->filebot && - openfile->filebot->data[0] == '\0') - continue; - - data_len = strlen(fileptr->data); + size_t data_len = strlen(fileptr->data), size; /* Newlines to nulls, just before we write to disk. */ sunder(fileptr->data); @@ -1437,10 +1428,9 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type goto cleanup_and_exit; } - /* If we're on the last line of the file and it isn't blank, - * don't write a newline character after it. */ - if (fileptr != openfile->filebot || - openfile->filebot->data[0] == '\0') { + /* If we're on the last line of the file, don't write a newline + * character after it. */ + if (fileptr != openfile->filebot) { #ifndef NANO_SMALL if (openfile->fmt == DOS_FILE || openfile->fmt == MAC_FILE) {