diff --git a/ChangeLog b/ChangeLog
index 859195d6f1f63cb9b42becd2b78dad0e0a6e5b9e..49ead8d541dc5e189eb53becd9fceaf3a4fa33db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@ CVS code -
   write_file()
 	- Since lineswritten is a size_t, print its value as an unsigned
 	  long instead of an unsigned int. (DLR)
+	- Declare the size_t i only in the loop where it's used. (DLR)
   cwd_tab_completion(), browser_init()
 	- Rename variable next to nextdir to avoid confusion. (DLR)
   input_tab()
@@ -81,6 +82,8 @@ CVS code -
 	- Add additional checks for variables' not being NULL before we
 	  try to free them, to avoid assertion failures. (DLR)
 - nano.c:
+  die()
+	- Rename variable ret to retval for consistency. (DLR)
   copy_filestruct()
 	- Rename variable prev to copy to avoid confusion. (DLR)
   print1opt_full()
diff --git a/src/files.c b/src/files.c
index b141e23e57ce98dcfd0f998823c070c31a355ab9..6bb4b4bfa674e8f4f07ced33987f42970ad74ecd 100644
--- a/src/files.c
+++ b/src/files.c
@@ -626,7 +626,8 @@ void do_insertfile(
 		execute_command(answer);
 	    else {
 #endif
-		answer = mallocstrassn(answer, real_dir_from_tilde(answer));
+		answer = mallocstrassn(answer,
+			real_dir_from_tilde(answer));
 		load_buffer(answer);
 #ifndef NANO_SMALL
 	    }
@@ -1411,13 +1412,12 @@ int write_file(const char *name, bool tmp, int append, bool
 	}
 
 	/* If backup_dir is set, we set backupname to
-	 * backup_dir/backupname~, where backupnae is the canonicalized
+	 * backup_dir/backupname~, where backupname is the canonicalized
 	 * absolute pathname of realname with every '/' replaced with a
 	 * '!'.  This means that /home/foo/file is backed up in
 	 * backup_dir/!home!foo!file~. */
 	if (backup_dir != NULL) {
 	    char *canon_realname = get_full_path(realname);
-	    size_t i;
 
 	    if (canon_realname == NULL)
 		/* If get_full_path() failed, we don't have a
@@ -1428,7 +1428,9 @@ int write_file(const char *name, bool tmp, int append, bool
 		 * backupdir/../backupname~. */
 		canon_realname = mallocstrcpy(NULL, tail(realname));
 	    else {
-		for (i = 0; canon_realname[i] != '\0'; i++) {
+		size_t i = 0;
+
+		for (; canon_realname[i] != '\0'; i++) {
 		    if (canon_realname[i] == '/')
 			canon_realname[i] = '!';
 		}
diff --git a/src/nano.c b/src/nano.c
index cb872902523480fe8f3158d5ee83dce3c7905b71..d3ed6b2dd4785e5e7adf3df457e4f69f1f1ab802 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -155,7 +155,7 @@ void die(const char *msg, ...)
 
 void die_save_file(const char *die_filename)
 {
-    char *ret;
+    char *retval;
     bool failed = TRUE;
 
     /* If we're using restricted mode, don't write any emergency backup
@@ -169,17 +169,18 @@ void die_save_file(const char *die_filename)
     if (die_filename[0] == '\0')
 	die_filename = "nano";
 
-    ret = get_next_filename(die_filename);
-    if (ret[0] != '\0')
-	failed = (write_file(ret, TRUE, FALSE, TRUE) == -1);
+    retval = get_next_filename(die_filename);
+    if (retval[0] != '\0')
+	failed = (write_file(retval, TRUE, FALSE, TRUE) == -1);
 
     if (!failed)
-	fprintf(stderr, _("\nBuffer written to %s\n"), ret);
+	fprintf(stderr, _("\nBuffer written to %s\n"), retval);
     else
 	fprintf(stderr,
-		_("\nBuffer not written to %s (too many backup files?)\n"), ret);
+		_("\nBuffer not written to %s (too many backup files?)\n"),
+		retval);
 
-    free(ret);
+    free(retval);
 }
 
 /* Die with an error message that the screen was too small if, well, the