From: JINMEI Tatuya Date: Fri, 20 Jul 2012 17:25:42 +0000 (-0700) Subject: [2090] use offset_ptr::get() for comparison with raw pointers by != X-Git-Tag: trac2351_base~158^2~17^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9ff329aa2fd6573f98201e4d3435dcc827f0820;p=thirdparty%2Fkea.git [2090] use offset_ptr::get() for comparison with raw pointers by != at least my version of boost doesn't seem to allow the direct comparison with != between offset_ptr and raw pointers. also made some trivial style fixes. --- diff --git a/src/lib/datasrc/rbtree.h b/src/lib/datasrc/rbtree.h index 3ff3833942..126aa6ef81 100644 --- a/src/lib/datasrc/rbtree.h +++ b/src/lib/datasrc/rbtree.h @@ -417,7 +417,7 @@ RBNode::abstractSuccessor(typename RBNode::RBNodePtr RBNode::*left, const RBNode* current = this; // If it has right node, the successor is the left-most node of the right // subtree. - if (current->*right != RBNode::NULL_NODE()) { + if ((current->*right).get() != RBNode::NULL_NODE()) { current = (current->*right).get(); const RBNode* left_n; while ((left_n = (current->*left).get()) != RBNode::NULL_NODE()) { @@ -1199,7 +1199,7 @@ RBTree::nextNode(RBTreeNodeChain& node_path) const { const RBNode* down = node->getDown(); if (down != NULLNODE) { const RBNode* left_most = down; - while (left_most->left_ != NULLNODE) { + while (left_most->getLeft() != NULLNODE) { left_most = left_most->getLeft(); } node_path.push(left_most); @@ -1478,7 +1478,7 @@ RBTree::insertRebalance(typename RBNode::RBNodePtr* root, { RBNode* uncle; RBNode* parent; - while (node != *root && + while (node != (*root).get() && (parent = node->getParent())->color_ == RBNode::RED) { if (parent == parent->getParent()->getLeft()) { uncle = parent->getParent()->getRight(); @@ -1525,13 +1525,14 @@ RBTree::insertRebalance(typename RBNode::RBNodePtr* root, template RBNode* RBTree::leftRotate(typename RBNode::RBNodePtr* root, RBNode* node) { - RBNode* right = node->getRight(); - RBNode* rleft = right->getLeft(); + RBNode* const right = node->getRight(); + RBNode* const rleft = right->getLeft(); node->right_ = rleft; - if (rleft != NULLNODE) + if (rleft != NULLNODE) { rleft->parent_ = node; + } - RBNode* parent = node->getParent(); + RBNode* const parent = node->getParent(); right->parent_ = parent; if (parent != NULLNODE) { @@ -1552,16 +1553,17 @@ RBTree::leftRotate(typename RBNode::RBNodePtr* root, RBNode* node) { template RBNode* RBTree::rightRotate(typename RBNode::RBNodePtr* root, RBNode* node) { - RBNode* left = node->getLeft(); - RBNode* lright = left->getRight(); + RBNode* const left = node->getLeft(); + RBNode* const lright = left->getRight(); node->left_ = lright; - if (lright != NULLNODE) + if (lright != NULLNODE) { lright->parent_ = node; + } - RBNode* parent = node->getParent(); + RBNode* const parent = node->getParent(); left->parent_ = parent; - if (node->parent_ != NULLNODE) { + if (node->getParent() != NULLNODE) { if (node == parent->getRight()) { parent->right_ = left; } else {