From cd1d435ac7529e1a8f574166e15754fde354bc69 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 22 Jan 2016 16:56:04 +0000 Subject: [PATCH] Renaming a variable for clarity and contrast. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/files.c | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 924be711..4a16352b 100644 --- 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 * src/prompt.c (get_prompt_string): Preserve the cursor position on diff --git a/src/files.c b/src/files.c index cbf64341..906970fa 100644 --- 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