MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _aspace_bst_insert

Function _aspace_bst_insert

components/mm/avl_adpt.c:149–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void _aspace_bst_insert(struct rt_aspace *aspace, struct rt_varea *varea)
150{
151 struct util_avl_root *root = &aspace->tree.tree;
152 struct util_avl_struct *current = NULL;
153 struct util_avl_struct **next = &(root->root_node);
154 rt_ubase_t key = (rt_ubase_t)varea->start;
155
156 /* Figure out where to put new node */
157 while (*next)
158 {
159 current = *next;
160 struct rt_varea *data = VAREA_ENTRY(current);
161
162 if (key < (rt_ubase_t)data->start)
163 next = &(current->avl_left);
164 else if (key > (rt_ubase_t)data->start)
165 next = &(current->avl_right);
166 else
167 return;
168 }
169
170 /* Add new node and rebalance tree. */
171 util_avl_link(&varea->node.node, current, next);
172 util_avl_rebalance(current, root);
173 return;
174}
175
176void _aspace_bst_remove(struct rt_aspace *aspace, struct rt_varea *varea)
177{

Callers 4

_expand_vareaFunction · 0.70
_insert_new_vareaFunction · 0.70
_shrink_vareaFunction · 0.70
_split_vareaFunction · 0.70

Calls 2

util_avl_linkFunction · 0.85
util_avl_rebalanceFunction · 0.85

Tested by

no test coverage detected