Rework RBTree to use RBNode in the compare function
This commit is contained in:
@@ -23,7 +23,7 @@ struct RBNode {
|
||||
typedef struct RBTree RBTree;
|
||||
struct RBTree {
|
||||
RBNode *node;
|
||||
int (*compare)(const void *a, const void *b);
|
||||
int (*compare)(const RBNode *a, const RBNode *b);
|
||||
};
|
||||
|
||||
/** Remove a node from the tree.
|
||||
@@ -35,14 +35,16 @@ void uc_rb_remove(RBTree *root, RBNode *node);
|
||||
|
||||
/** Find a node in the tree.
|
||||
*
|
||||
* The value to find will be in a node->data pointer, the compare
|
||||
* The value to find must be of the same type as the
|
||||
* other nodes inserted into a tree. This will normally
|
||||
* be a user defined struct with the RBNode as one of its members
|
||||
* function of the tree is used to find the matching item.
|
||||
*
|
||||
* @param root Root of the tree
|
||||
* @param val The value to find.
|
||||
* @return the found node
|
||||
*/
|
||||
RBNode *uc_rb_find(RBTree *root, const void *val);
|
||||
RBNode *uc_rb_find(RBTree *root, const RBNode *val);
|
||||
|
||||
/** insert a new node
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user