Changeset 21d97e8 in mainline for uspace/lib/cpp/include/internal/rbtree.hpp
- Timestamp:
- 2018-07-05T21:41:23Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fe0f32
- Parents:
- 5608106c
- git-author:
- Dzejrou <dzejrou@…> (2018-05-14 17:03:57)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/internal/rbtree.hpp
r5608106c r21d97e8 353 353 if (!node) 354 354 return nullptr; 355 356 --size_; 357 358 auto succ = node->successor(); 355 359 if (auto tmp = node->get_node_for_deletion(); tmp != nullptr) 356 360 { … … 359 363 * we popped one node from a list of nodes 360 364 * with equivalent keys and we can delete it 361 * and return the original as it is still362 * in place.365 * and return the successor which was the next 366 * in the list. 363 367 */ 364 368 delete tmp; 365 369 366 return node; 367 } 368 369 --size_; 370 371 if (node == root_) 372 { 370 update_root_(succ); // Incase the first in list was root. 371 return succ; 372 } 373 else if (node == root_) 374 { // Only executed if root_ is unique. 375 root_ = nullptr; 373 376 delete node; 374 root_ = nullptr;375 377 376 378 return nullptr; 377 379 } 378 380 379 auto succ = node->successor();380 381 if (node->left() && node->right()) 381 382 { … … 407 408 else if (node->is_right_child()) 408 409 child->parent()->right(child); 410 node->parent(nullptr); 411 node->left(nullptr); 412 node->right(nullptr); 409 413 410 414 // Repair if needed.
Note:
See TracChangeset
for help on using the changeset viewer.