nano

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

commit 5ebd73f9a5d1655089df429b9bf0e16eb36fece6
parent 02173c05dccf6e192df625666e6598b7cee3b00b
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Sat, 14 May 2005 20:52:20 +0000

more cosmetic fixes


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2505 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
Msrc/nano.c | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -584,10 +584,12 @@ void help_init(void) filestruct *make_new_node(filestruct *prevnode) { filestruct *newnode = (filestruct *)nmalloc(sizeof(filestruct)); + newnode->data = NULL; newnode->prev = prevnode; newnode->next = NULL; newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1; + return newnode; } @@ -642,27 +644,27 @@ void delete_node(filestruct *fileptr) free(fileptr); } -/* Okay, now let's duplicate a whole struct! */ +/* Duplicate a whole filestruct. */ filestruct *copy_filestruct(const filestruct *src) { - filestruct *head; /* copy of src, top of the copied list */ - filestruct *prev; /* temp that traverses the list */ + filestruct *head, *copy; assert(src != NULL); - prev = copy_node(src); - prev->prev = NULL; - head = prev; + copy = copy_node(src); + copy->prev = NULL; + head = copy; src = src->next; + while (src != NULL) { - prev->next = copy_node(src); - prev->next->prev = prev; - prev = prev->next; + copy->next = copy_node(src); + copy->next->prev = copy; + copy = copy->next; src = src->next; } + copy->next = NULL; - prev->next = NULL; return head; }