| 147 | } |
| 148 | |
| 149 | void _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 | |
| 176 | void _aspace_bst_remove(struct rt_aspace *aspace, struct rt_varea *varea) |
| 177 | { |
no test coverage detected