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()
- 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()
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
}
}
/* 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
* 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] = '!';
}
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
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