tweaks: rename a variable, to be distinct and visible

master
Benno Schulenberg 2019-10-17 12:17:09 +02:00
parent eb757e7c5b
commit 6fad6a17da
1 changed files with 12 additions and 12 deletions

View File

@ -1514,7 +1514,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
/* Will be set to the umask from when nano was started. */ /* Will be set to the umask from when nano was started. */
char *realname; char *realname;
/* The filename after tilde expansion. */ /* The filename after tilde expansion. */
FILE *f = stream; FILE *thefile = stream;
/* The actual file, corresponding to realname, we are writing to. */ /* The actual file, corresponding to realname, we are writing to. */
char *tempname = NULL; char *tempname = NULL;
/* The name of the temporary file we write to on prepend. */ /* The name of the temporary file we write to on prepend. */
@ -1772,9 +1772,9 @@ bool write_file(const char *name, FILE *stream, bool tmp,
goto cleanup_and_exit; goto cleanup_and_exit;
} }
f = fdopen(fd, (method == APPEND) ? "ab" : "wb"); thefile = fdopen(fd, (method == APPEND) ? "ab" : "wb");
if (f == NULL) { if (thefile == NULL) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
close(fd); close(fd);
@ -1791,7 +1791,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
/* Decode LFs as the NULs that they are, before writing to disk. */ /* Decode LFs as the NULs that they are, before writing to disk. */
sunder(line->data); sunder(line->data);
size = fwrite(line->data, sizeof(char), data_len, f); size = fwrite(line->data, sizeof(char), data_len, thefile);
/* Re-encode any embedded NULs as LFs. */ /* Re-encode any embedded NULs as LFs. */
unsunder(line->data, data_len); unsunder(line->data, data_len);
@ -1799,7 +1799,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
if (size < data_len) { if (size < data_len) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
fclose(f); fclose(thefile);
goto cleanup_and_exit; goto cleanup_and_exit;
} }
@ -1813,20 +1813,20 @@ bool write_file(const char *name, FILE *stream, bool tmp,
} else { } else {
#ifndef NANO_TINY #ifndef NANO_TINY
if (openfile->fmt == DOS_FILE || openfile->fmt == MAC_FILE) { if (openfile->fmt == DOS_FILE || openfile->fmt == MAC_FILE) {
if (putc('\r', f) == EOF) { if (putc('\r', thefile) == EOF) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
fclose(f); fclose(thefile);
goto cleanup_and_exit; goto cleanup_and_exit;
} }
} }
if (openfile->fmt != MAC_FILE) if (openfile->fmt != MAC_FILE)
#endif #endif
if (putc('\n', f) == EOF) { if (putc('\n', thefile) == EOF) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
fclose(f); fclose(thefile);
goto cleanup_and_exit; goto cleanup_and_exit;
} }
} }
@ -1843,11 +1843,11 @@ bool write_file(const char *name, FILE *stream, bool tmp,
if (source == NULL) { if (source == NULL) {
statusline(ALERT, _("Error reading %s: %s"), tempname, statusline(ALERT, _("Error reading %s: %s"), tempname,
strerror(errno)); strerror(errno));
fclose(f); fclose(thefile);
goto cleanup_and_exit; goto cleanup_and_exit;
} }
if (copy_file(source, f, TRUE) != 0) { if (copy_file(source, thefile, TRUE) != 0) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
goto cleanup_and_exit; goto cleanup_and_exit;
@ -1856,7 +1856,7 @@ bool write_file(const char *name, FILE *stream, bool tmp,
unlink(tempname); unlink(tempname);
} else } else
#endif #endif
if (fclose(f) != 0) { if (fclose(thefile) != 0) {
statusline(ALERT, _("Error writing %s: %s"), realname, statusline(ALERT, _("Error writing %s: %s"), realname,
strerror(errno)); strerror(errno));
goto cleanup_and_exit; goto cleanup_and_exit;