[svn] commit: r3777 - /branches/trac397focused/src/lib/datasrc/rbtree.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Dec 9 03:21:45 UTC 2010
Author: hanfeng
Date: Thu Dec 9 03:21:45 2010
New Revision: 3777
Log:
remove NOMEM flag, rbtree won't catch the bad_alloc exception
Modified:
branches/trac397focused/src/lib/datasrc/rbtree.h
Modified: branches/trac397focused/src/lib/datasrc/rbtree.h
==============================================================================
--- branches/trac397focused/src/lib/datasrc/rbtree.h (original)
+++ branches/trac397focused/src/lib/datasrc/rbtree.h Thu Dec 9 03:21:45 2010
@@ -265,7 +265,6 @@
NOTFOUND, // for find function means no related name found
// for erase function means erase not exist name
ALREADYEXIST, //for insert operation, the name to insert already exist
- NOMEM //no memory to create new node
};
/// \name Constructor and Destructor
@@ -314,7 +313,6 @@
/// \return
// - SUCCEED means no node exists in the tree with the name before insert
/// - ALREADYEXIST means already has the node with the given name
- /// - NOMEM means no memory left to allocate new node
//
/// \node To modify the data related with one name but not sure the name has
/// inserted or not, it is better to call \code insert \endcode,instead of
@@ -351,9 +349,7 @@
/// node, old node will hold the base name, new node will be the down node
/// of old node, new node will hold the sub_name, the data
/// of old node will be move into new node, and old node became non-terminal
- /// \return NOMEM: means no memory to create new node
- /// otherwise return SUCCEED
- Result nodeFission(RBNode<T>& node, const isc::dns::Name& sub_name);
+ void nodeFission(RBNode<T>& node, const isc::dns::Name& sub_name);
//@}
RBNode<T>* root_;
@@ -539,9 +535,7 @@
const isc::dns::Name common_ancestor = name.split(
name.getLabelCount() - common_label_count,
common_label_count);
- if (nodeFission(*current, common_ancestor) == NOMEM) {
- return (NOMEM);
- }
+ nodeFission(*current, common_ancestor);
}
}
}
@@ -570,12 +564,11 @@
template <typename T>
-typename RBTree<T>::Result
+void
RBTree<T>::nodeFission(RBNode<T>& node, const isc::dns::Name& base_name) {
using namespace helper;
const isc::dns::Name sub_name = node.name_ - base_name;
std::auto_ptr<RBNode<T> > down_node(new RBNode<T>(node.name_ - base_name));
-
node.swap(*down_node);
node.name_ = base_name;
node.down_ = down_node.get();
@@ -584,7 +577,6 @@
down_node->color_ = BLACK;
++node_count_;
down_node.release();
- return (SUCCEED);
}
template <typename T>
More information about the bind10-changes
mailing list