Lines Matching refs:tree

79 static int find_and_stack(struct rbtree *tree, struct rbnode *node,  in find_and_stack()  argument
84 stack[sz] = tree->root; in find_and_stack()
88 uint8_t side = tree->lessthan_fn(node, stack[sz - 1]) ? 0U : 1U; in find_and_stack()
102 struct rbnode *z_rb_get_minmax(struct rbtree *tree, uint8_t side) in z_rb_get_minmax() argument
106 for (n = tree->root; (n != NULL) && (get_child(n, side) != NULL); in z_rb_get_minmax()
219 void rb_insert(struct rbtree *tree, struct rbnode *node) in rb_insert() argument
224 if (tree->root == NULL) { in rb_insert()
225 tree->root = node; in rb_insert()
226 tree->max_depth = 1; in rb_insert()
232 struct rbnode **stack = &tree->iter_stack[0]; in rb_insert()
234 struct rbnode *stack[tree->max_depth + 1]; in rb_insert()
237 int stacksz = find_and_stack(tree, node, stack); in rb_insert()
241 uint8_t side = tree->lessthan_fn(node, parent) ? 0U : 1U; in rb_insert()
250 if (stacksz > tree->max_depth) { in rb_insert()
251 tree->max_depth = stacksz; in rb_insert()
255 tree->root = stack[0]; in rb_insert()
256 CHECK(is_black(tree->root)); in rb_insert()
372 void rb_remove(struct rbtree *tree, struct rbnode *node) in rb_remove() argument
376 struct rbnode **stack = &tree->iter_stack[0]; in rb_remove()
378 struct rbnode *stack[tree->max_depth + 1]; in rb_remove()
381 int stacksz = find_and_stack(tree, node, stack); in rb_remove()
427 tree->root = node2; in rb_remove()
464 tree->root = child; in rb_remove()
468 tree->max_depth = 0; in rb_remove()
500 tree->root = stack[0]; in rb_remove()
524 bool rb_contains(struct rbtree *tree, struct rbnode *node) in rb_contains() argument
526 struct rbnode *n = tree->root; in rb_contains()
529 n = get_child(n, tree->lessthan_fn(n, node)); in rb_contains()
564 struct rbnode *z_rb_foreach_next(struct rbtree *tree, struct _rb_foreach *f) in z_rb_foreach_next() argument
568 if (tree->root == NULL) { in z_rb_foreach_next()
576 return stack_left_limb(tree->root, f); in z_rb_foreach_next()