Skip to content

Commit

Permalink
Remove obsolete function insertchild
Browse files Browse the repository at this point in the history
This function has been obsoleted by the previous commit. Remove it.
  • Loading branch information
donald committed Mar 22, 2019
1 parent fa4bd97 commit 2e074ca
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions xdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,55 +421,6 @@ int compare(struct node* n1, struct node* n2, int order)
return 0;
}

void insertchild(struct node* nodep, struct node* childp, int order)
{
struct node *np,
*np1;

if (nodep == NODE_NULL || childp == NODE_NULL)
return;
if (childp->peer != NODE_NULL) {
fprintf(stderr, "xdu: can't insert child with peers\n");
return;
}

childp->parent = nodep;
if (nodep->child == NODE_NULL) {
/*
* no children, order doesn't matter
*/
nodep->child = childp;
return;
}
/*
* nodep has at least one child already
*/
if (compare(childp, nodep->child, order) < 0) {
/*
* new first child
*/
childp->peer = nodep->child;
nodep->child = childp;
return;
}
np1 = nodep->child;
for (np = np1->peer; np != NODE_NULL; np = np->peer) {
if (compare(childp, np, order) < 0) {
/*
* insert between np1 and np
*/
childp->peer = np;
np1->peer = childp;
return;
}
np1 = np;
}
/*
* at end, link new child on
*/
np1->peer = childp;
}

/*
* add path as a child of top - recursively
*/
Expand Down

0 comments on commit 2e074ca

Please sign in to comment.