Commit 5ebd73f9 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

more cosmetic fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2505 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 12 additions and 10 deletions
+12 -10
...@@ -584,10 +584,12 @@ void help_init(void) ...@@ -584,10 +584,12 @@ void help_init(void)
filestruct *make_new_node(filestruct *prevnode) filestruct *make_new_node(filestruct *prevnode)
{ {
filestruct *newnode = (filestruct *)nmalloc(sizeof(filestruct)); filestruct *newnode = (filestruct *)nmalloc(sizeof(filestruct));
newnode->data = NULL; newnode->data = NULL;
newnode->prev = prevnode; newnode->prev = prevnode;
newnode->next = NULL; newnode->next = NULL;
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1; newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
return newnode; return newnode;
} }
...@@ -642,27 +644,27 @@ void delete_node(filestruct *fileptr) ...@@ -642,27 +644,27 @@ void delete_node(filestruct *fileptr)
free(fileptr); free(fileptr);
} }
/* Okay, now let's duplicate a whole struct! */ /* Duplicate a whole filestruct. */
filestruct *copy_filestruct(const filestruct *src) filestruct *copy_filestruct(const filestruct *src)
{ {
filestruct *head; /* copy of src, top of the copied list */ filestruct *head, *copy;
filestruct *prev; /* temp that traverses the list */
assert(src != NULL); assert(src != NULL);
prev = copy_node(src); copy = copy_node(src);
prev->prev = NULL; copy->prev = NULL;
head = prev; head = copy;
src = src->next; src = src->next;
while (src != NULL) { while (src != NULL) {
prev->next = copy_node(src); copy->next = copy_node(src);
prev->next->prev = prev; copy->next->prev = copy;
prev = prev->next; copy = copy->next;
src = src->next; src = src->next;
} }
copy->next = NULL;
prev->next = NULL;
return head; return head;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment