Hi,
I'm using rb_tree_find_node_leq, but I think it doesn't work as the
manual says.
The manual entry (RBTREE(3)) contains:
"rb_tree_find_node_leq(rbt, key)
Search the tree rbt for a node that exactly matches key and return it.
If no such node is present, return the first node preceding key or, if
no such node is in the tree, return NULL."
When I look for a key which is in the tree, it returns with the correct
node, but if I increment the key, it returns NULL.
Example:
struct node_frag *node;
struct node_frag *probe = (struct node_frag*)RB_TREE_MIN(fragtree);
int key = 0;
if (probe) {
key = probe->ofs;
node = (struct node_frag *)rb_tree_find_node_leq(fragtree, &key);
// here node variable is correct
key = probe->ofs+2;
node = (struct node_frag *)rb_tree_find_node_leq(fragtree, &key);
// here node variable is null
}