Just a quick note, if someone needs (for an addon) to traverse an rbtree,
here is the clean way:
static ngx_inline ngx_rbtree_node_t *
ngx_rbtree_next(ngx_rbtree_t *rbtree, ngx_rbtree_node_t *node)
{
ngx_rbtree_node_t *sentinel;
sentinel = rbtree->sentinel;
if( node->right != sentinel )
{
node = node->right;
while( node->left != sentinel )
node = node->left;
}
else
{
ngx_rbtree_node_t *root, *temp;
root = rbtree->root;
temp = node;
while( temp != root && node == temp->parent->right )
temp = node = temp->parent;
if( temp == root )
return sentinel;
if( node->right != temp->parent )
node = temp->parent;
}
return node;
}