10.6.4 Advancing to the Next Node [ToC] [Index]     [Skip Back] [Skip Fwd]     [Prev] [Up] [Next]

We use the same algorithm to advance an RTBST traverser as for TBST traversers. The only important difference between this code and <TBST traverser advance function 275> is the substitution of rtbst_rtag for tbst_tag[1].

399. <RTBST traverser advance function 399> =
void *
rtbst_t_next (struct rtbst_traverser *trav)
{ assert (trav != NULL); if (trav->rtbst_node == NULL) return rtbst_t_first (trav, trav->rtbst_table); else if (trav->rtbst_node->rtbst_rtag == RTBST_THREAD)
    { trav->rtbst_node = trav->rtbst_node->rtbst_link[1]; return trav->rtbst_node != NULL ? trav->rtbst_node->rtbst_data : NULL; }
  else
    { trav->rtbst_node = trav->rtbst_node->rtbst_link[1]; while (trav->rtbst_node->rtbst_link[0] != NULL) trav->rtbst_node = trav->rtbst_node->rtbst_link[0]; return trav->rtbst_node->rtbst_data; } }

This code is included in 395.