Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rb.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <alloca.h>

Go to the source code of this file.

Data Structures

struct  rbnode
 Balanced red/black tree node structure. More...
 
struct  rbtree
 Balanced red/black tree structure. More...
 

Macros

#define RB_FOR_EACH(tree, node)
 Walk a tree in-order without recursing.
 
#define RB_FOR_EACH_CONTAINER(tree, node, field)
 Loop over rbtree with implicit container field logic.
 

Typedefs

typedef bool(* rb_lessthan_t) (struct rbnode *a, struct rbnode *b)
 Red/black tree comparison predicate.
 
typedef void(* rb_visit_t) (struct rbnode *node, void *cookie)
 Prototype for node visitor callback.
 

Functions

void rb_insert (struct rbtree *tree, struct rbnode *node)
 Insert node into tree.
 
void rb_remove (struct rbtree *tree, struct rbnode *node)
 Remove node from tree.
 
static struct rbnoderb_get_min (struct rbtree *tree)
 Returns the lowest-sorted member of the tree.
 
static struct rbnoderb_get_max (struct rbtree *tree)
 Returns the highest-sorted member of the tree.
 
bool rb_contains (struct rbtree *tree, struct rbnode *node)
 Returns true if the given node is part of the tree.
 
static void rb_walk (struct rbtree *tree, rb_visit_t visit_fn, void *cookie)
 Walk/enumerate a rbtree.