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

The outline for the deletion function follows the usual pattern.

349. <TRB item deletion function 349> =
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 350> <Step 2: Delete item from TRB tree 351> <Step 3: Rebalance tree after TRB deletion 356> <Step 4: Finish up after TRB deletion 362> }

This code is included in 336.