nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 7d3290fb9164f1ae75b215cb4269263a88e865be
parent df0ae2ace5aa6d6eb25ed6a3b1e8f532800bb1ce
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 16 Oct 2019 11:04:26 +0200

tweaks: rename three variables, to be consistent with other linestructs

Diffstat:
Msrc/files.c | 18+++++++++---------
Msrc/nano.c | 26+++++++++++++-------------
2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -1529,7 +1529,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, /* The actual file, realname, we are writing to. */ char *tempname = NULL; /* The name of the temporary file we write to on prepend. */ - const linestruct *fileptr = openfile->filetop; + linestruct *line = openfile->filetop; /* An iterator for moving through the lines of the buffer. */ size_t lineswritten = 0; /* The number of lines written, for feedback on the status bar. */ @@ -1825,16 +1825,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp, if (!tmp) statusbar(_("Writing...")); - while (fileptr != NULL) { - size_t data_len = strlen(fileptr->data), size; + while (line != NULL) { + size_t data_len = strlen(line->data), size; /* Decode LFs as the NULs that they are, before writing to disk. */ - sunder(fileptr->data); + sunder(line->data); - size = fwrite(fileptr->data, sizeof(char), data_len, f); + size = fwrite(line->data, sizeof(char), data_len, f); /* Re-encode any embedded NULs as LFs. */ - unsunder(fileptr->data, data_len); + unsunder(line->data, data_len); if (size < data_len) { statusline(ALERT, _("Error writing %s: %s"), realname, @@ -1847,8 +1847,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, * character after it. If the last line of the file is blank, * this means that zero bytes are written, in which case we * don't count the last line in the total lines written. */ - if (fileptr == openfile->filebot) { - if (fileptr->data[0] == '\0') + if (line == openfile->filebot) { + if (line->data[0] == '\0') lineswritten--; } else { #ifndef NANO_TINY @@ -1871,7 +1871,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, } } - fileptr = fileptr->next; + line = line->next; lineswritten++; } diff --git a/src/nano.c b/src/nano.c @@ -127,33 +127,33 @@ void splice_node(linestruct *afterthis, linestruct *newnode) } /* Disconnect a node from a linked list of linestructs and delete it. */ -void unlink_node(linestruct *fileptr) +void unlink_node(linestruct *line) { - if (fileptr->prev != NULL) - fileptr->prev->next = fileptr->next; - if (fileptr->next != NULL) - fileptr->next->prev = fileptr->prev; + if (line->prev != NULL) + line->prev->next = line->next; + if (line->next != NULL) + line->next->prev = line->prev; /* Update filebot when removing a node at the end of file. */ - if (openfile && openfile->filebot == fileptr) - openfile->filebot = fileptr->prev; + if (openfile && openfile->filebot == line) + openfile->filebot = line->prev; - delete_node(fileptr); + delete_node(line); } /* Free the data structures in the given node. */ -void delete_node(linestruct *fileptr) +void delete_node(linestruct *line) { #ifdef ENABLE_WRAPPING /* If the spill-over line for hard-wrapping is deleted... */ - if (fileptr == openfile->spillage_line) + if (line == openfile->spillage_line) openfile->spillage_line = NULL; #endif - free(fileptr->data); + free(line->data); #ifdef ENABLE_COLOR - free(fileptr->multidata); + free(line->multidata); #endif - free(fileptr); + free(line); } /* Duplicate an entire linked list of linestructs. */