commit cd1d435ac7529e1a8f574166e15754fde354bc69
parent 3a3b1764af9facd762abe6ffc2ebc379186962a1
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 22 Jan 2016 16:56:04 +0000
Renaming a variable for clarity and contrast.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -3,6 +3,7 @@
some sudos don't filter it out of the environment (which can lead to
a root-owned .nano/ directory in the invoking user's home directory).
It fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.
+ * src/files.c (read_line): Rename a variable for clarity and contrast.
2016-01-21 Benno Schulenberg <bensberg@justemail.net>
* src/prompt.c (get_prompt_string): Preserve the cursor position on
diff --git a/src/files.c b/src/files.c
@@ -632,42 +632,42 @@ int is_file_writable(const char *filename)
* Then attach this line after prevnode. */
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode)
{
- filestruct *fileptr = (filestruct *)nmalloc(sizeof(filestruct));
+ filestruct *freshline = (filestruct *)nmalloc(sizeof(filestruct));
/* Convert nulls to newlines. buf_len is the string's real length. */
unsunder(buf, buf_len);
assert(openfile->fileage != NULL && strlen(buf) == buf_len);
- fileptr->data = mallocstrcpy(NULL, buf);
+ freshline->data = mallocstrcpy(NULL, buf);
#ifndef NANO_TINY
/* If it's a DOS file ("\r\n"), and file conversion isn't disabled,
- * strip the '\r' part from fileptr->data. */
+ * strip the '\r' part from the data. */
if (!ISSET(NO_CONVERT) && buf_len > 0 && buf[buf_len - 1] == '\r')
- fileptr->data[buf_len - 1] = '\0';
+ freshline->data[buf_len - 1] = '\0';
#endif
#ifndef DISABLE_COLOR
- fileptr->multidata = NULL;
+ freshline->multidata = NULL;
#endif
- fileptr->prev = prevnode;
+ freshline->prev = prevnode;
if (prevnode == NULL) {
/* Special case: we're inserting into the first line. */
- fileptr->next = openfile->fileage;
- openfile->fileage = fileptr;
- fileptr->lineno = 1;
+ freshline->next = openfile->fileage;
+ openfile->fileage = freshline;
+ freshline->lineno = 1;
/* Make sure that our edit window stays on the first line. */
- openfile->edittop = fileptr;
+ openfile->edittop = freshline;
} else {
- prevnode->next = fileptr;
- fileptr->next = NULL;
- fileptr->lineno = prevnode->lineno + 1;
+ prevnode->next = freshline;
+ freshline->next = NULL;
+ freshline->lineno = prevnode->lineno + 1;
}
- return fileptr;
+ return freshline;
}
/* Read an open file into the current buffer. f should be set to the