From 9e7b2d572c3678df4b7cdbe3c6d5b0945b7f97c0 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 11 Jan 2007 22:46:22 +0000 Subject: [PATCH] more miscellaneous minor fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4031 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 2 +- src/nano.c | 3 +-- src/text.c | 14 +++++++------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48da84b6..acbb3820 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,10 @@ CVS code - regexp_init() - Don't assign rc's value via regcomp() until we've asserted that regexp_compiled is FALSE. (DLR) +- text.c: + do_alt_speller() + - Rename variable altspell_error to alt_spell_error, for + consistency. (DLR) - winio.c: do_credits() - Update the last copyright notice to include 2006. (DLR) diff --git a/src/files.c b/src/files.c index d5ac344e..f697a791 100644 --- a/src/files.c +++ b/src/files.c @@ -1701,7 +1701,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type bool write_marked_file(const char *name, FILE *f_open, bool tmp, append_type append) { - bool retval = FALSE; + bool retval; bool old_modified = openfile->modified; /* write_file() unsets the modified flag. */ bool added_magicline = FALSE; diff --git a/src/nano.c b/src/nano.c index 4cbe8933..19516e75 100644 --- a/src/nano.c +++ b/src/nano.c @@ -613,8 +613,7 @@ void die_save_file(const char *die_filename) retval = get_next_filename(die_filename, ".save"); if (retval[0] != '\0') - failed = (write_file(retval, NULL, TRUE, OVERWRITE, - TRUE) == -1); + failed = (!write_file(retval, NULL, TRUE, OVERWRITE, TRUE)); if (!failed) fprintf(stderr, _("\nBuffer written to %s\n"), retval); diff --git a/src/text.c b/src/text.c index 3604894f..e9f548fa 100644 --- a/src/text.c +++ b/src/text.c @@ -2197,7 +2197,7 @@ const char *do_alt_speller(char *tempfile_name) if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) { - char *altspell_error; + char *alt_spell_error; char *invoke_error = _("Error invoking \"%s\""); #ifndef NANO_TINY @@ -2205,11 +2205,11 @@ const char *do_alt_speller(char *tempfile_name) openfile->mark_set = old_mark_set; #endif - altspell_error = + alt_spell_error = charalloc(strlen(invoke_error) + strlen(alt_speller) + 1); - sprintf(altspell_error, invoke_error, alt_speller); - return altspell_error; + sprintf(alt_spell_error, invoke_error, alt_speller); + return alt_spell_error; } #ifndef NANO_TINY @@ -2301,7 +2301,7 @@ const char *do_alt_speller(char *tempfile_name) * specified, use it. Otherwise, use the internal spell checker. */ void do_spell(void) { - int i; + bool status; FILE *temp_file; char *temp = safe_tempfile(&temp_file); const char *spell_msg; @@ -2311,14 +2311,14 @@ void do_spell(void) return; } - i = + status = #ifndef NANO_TINY (openfile->mark_set) ? write_marked_file(temp, temp_file, TRUE, OVERWRITE) : #endif write_file(temp, temp_file, TRUE, OVERWRITE, FALSE); - if (i == -1) { + if (!status) { statusbar(_("Error writing temp file: %s"), strerror(errno)); free(temp); return;