mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 04:41:21 +03:00
Removing a senseless iteration: simply add the new record at the tail.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5552 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
deb271d708
commit
73ee7d7ee5
@ -4,6 +4,7 @@
|
||||
* src/files.c (load_poshistory): Remove some code duplication.
|
||||
* src/files.c (save_poshistory, update_poshistory, check_poshistory,
|
||||
load_poshistory): Differentiate variable name from function names.
|
||||
* src/files.c (load_poshistory): Remove a senseless iteration.
|
||||
|
||||
GNU nano 2.5.1 - 2016.01.11
|
||||
|
||||
|
11
src/files.c
11
src/files.c
@ -3217,7 +3217,7 @@ void load_poshistory(void)
|
||||
char *line = NULL, *lineptr, *xptr;
|
||||
size_t buf_len = 0;
|
||||
ssize_t read;
|
||||
poshiststruct *posptr, *newrecord;
|
||||
poshiststruct *record_ptr = NULL, *newrecord;
|
||||
|
||||
/* Read and parse each line, and store the extracted data. */
|
||||
while ((read = getline(&line, &buf_len, hist)) >= 0) {
|
||||
@ -3240,11 +3240,10 @@ void load_poshistory(void)
|
||||
/* Add the record to the list. */
|
||||
if (position_history == NULL)
|
||||
position_history = newrecord;
|
||||
else {
|
||||
for (posptr = position_history; posptr->next != NULL;)
|
||||
posptr = posptr->next;
|
||||
posptr->next = newrecord;
|
||||
}
|
||||
else
|
||||
record_ptr->next = newrecord;
|
||||
|
||||
record_ptr = newrecord;
|
||||
}
|
||||
fclose(hist);
|
||||
free(line);
|
||||
|
Loading…
Reference in New Issue
Block a user