| 440 | #endif |
| 441 | |
| 442 | void _aspace_bst_insert(struct rt_aspace *aspace, struct rt_varea *varea) |
| 443 | { |
| 444 | struct util_avl_root *root = &aspace->tree.tree; |
| 445 | struct util_avl_struct *current = NULL; |
| 446 | struct util_avl_struct **next = &(root->root_node); |
| 447 | rt_ubase_t key = (rt_ubase_t)varea->start; |
| 448 | |
| 449 | /* Figure out where to put new node */ |
| 450 | while (*next) |
| 451 | { |
| 452 | current = *next; |
| 453 | struct rt_varea *data = VAREA_ENTRY(current); |
| 454 | |
| 455 | if (key < (rt_ubase_t)data->start) |
| 456 | next = &(current->avl_left); |
| 457 | else if (key > (rt_ubase_t)data->start) |
| 458 | next = &(current->avl_right); |
| 459 | else |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | /* Add new node and rebalance tree. */ |
| 464 | _check_bst_before(aspace, varea); |
| 465 | util_avl_link(&varea->node.node, current, next); |
| 466 | util_avl_rebalance(current, root); |
| 467 | _check_bst_after(aspace, varea, 0); |
| 468 | return; |
| 469 | } |
| 470 | |
| 471 | void _aspace_bst_remove(struct rt_aspace *aspace, struct rt_varea *varea) |
| 472 | { |
no test coverage detected