mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-23 01:32:06 +03:00
tweaks: rename three variables, to be consistent with other linestructs
This commit is contained in:
parent
df0ae2ace5
commit
7d3290fb91
18
src/files.c
18
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++;
|
||||
}
|
||||
|
||||
|
26
src/nano.c
26
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. */
|
||||
|
Loading…
Reference in New Issue
Block a user