[svn] commit: r3613 - /branches/trac397/src/bin/auth/rbt_datasrc.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Nov 23 03:11:25 UTC 2010
Author: hanfeng
Date: Tue Nov 23 03:11:25 2010
New Revision: 3613
Log:
modify the interface of find in rbtree to return rbnode instead of const rbnode
Modified:
branches/trac397/src/bin/auth/rbt_datasrc.h
Modified: branches/trac397/src/bin/auth/rbt_datasrc.h
==============================================================================
--- branches/trac397/src/bin/auth/rbt_datasrc.h (original)
+++ branches/trac397/src/bin/auth/rbt_datasrc.h Tue Nov 23 03:11:25 2010
@@ -135,8 +135,7 @@
name_(name),
data_(data),
down_(NULL),
- is_shadow_(false)
-{
+ is_shadow_(false) {
}
template <typename T>
@@ -147,8 +146,7 @@
color_(RED),
name_(name),
down_(NULL),
- is_shadow_(false)
-{
+ is_shadow_(false) {
}
template <typename T>
@@ -232,7 +230,7 @@
/// \param node Point to the node when the return vaule is \c not
/// NOTFOUND, if the return value is NOTFOUND, the value of node is
/// \c unknown
- FindResult find(const Name& name, const RBNode<T>** node) const;
+ FindResult find(const Name& name, RBNode<T>** node) const;
/// \brief Get the total node count in the tree
/// the node count including the node created common suffix node
@@ -286,7 +284,7 @@
/// Each public function has related recursive helper function
void eraseNode(RBNode<T>* node);
FindResult findHelper(const Name& name, const RBTree<T>** tree,
- const RBNode<T>** node) const;
+ RBNode<T>** node) const;
int getNodeCountHelper(const RBNode<T>* node) const;
int getNameCountHelper(const RBNode<T>* node) const;
void printTreeHelper(std::ostream &os, const RBNode<T>* node, int depth) const;
@@ -358,17 +356,20 @@
root_ = NULL;
}
+
template <typename T>
typename RBTree<T>::FindResult
-RBTree<T>::find(const Name& name, const RBNode<T>** node) const {
- const RBTree<T>* tree;
+RBTree<T>::find(const Name& name, RBNode<T>** node) const {
+ const RBTree<T> *tree;
return (findHelper(name, &tree, node));
}
+
+
template <typename T>
typename RBTree<T>::FindResult
RBTree<T>::findHelper(const Name& name, const RBTree<T>** tree,
- const RBNode<T>** ret) const
+ RBNode<T>** ret) const
{
RBNode<T>* node = root_;
while (node != NULLNODE) {
@@ -694,14 +695,13 @@
template <typename T>
int
RBTree<T>::erase(const Name& name) {
- const RBNode<T>* cnode;
+ RBNode<T>* node;
const RBTree<T>* ctree;
- if (findHelper(name, &ctree, &cnode) != RBTree<T>::EXACTMATCH) {
+ if (findHelper(name, &ctree, &node) != RBTree<T>::EXACTMATCH) {
return (1);
}
// for node with downpointer, set it to shadow
- RBNode<T>* node = const_cast<RBNode<T>*>(cnode);
if (node->down_ != NULL) {
assert(node->is_shadow_ == false);
node->is_shadow_ = true;
More information about the bind10-changes
mailing list