9.4 Deletion [ToC] [Index]     [Skip Back] [Skip Fwd]     [Prev] [Up] [Next]

The outline for the deletion function follows the usual pattern.

351. <TRB item deletion function 351> =
void *
trb_delete (struct trb_table *tree, const void *item)
{ struct trb_node *pa[TRB_MAX_HEIGHT]; /* Nodes on stack. */ unsigned char da[TRB_MAX_HEIGHT]; /* Directions moved from stack nodes. */ int k = 0; /* Stack height. */ struct trb_node *p; int cmp, dir; assert (tree != NULL && item != NULL); <Step 1: Search TRB tree for item to delete 352> <Step 2: Delete item from TRB tree 353> <Step 3: Rebalance tree after TRB deletion 358> <Step 4: Finish up after TRB deletion 364> }

This code is included in 338.