BIND 10 trac517, updated. c73a307cb41eb3e8bb6681dd963f6953973330ca [trac517] make RBTreeNodeChain non copyable

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Feb 2 22:14:49 UTC 2011


The branch, trac517 has been updated
       via  c73a307cb41eb3e8bb6681dd963f6953973330ca (commit)
      from  1a52db4373a1c4169b0bbd9bc6a550e5a3e68b39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c73a307cb41eb3e8bb6681dd963f6953973330ca
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Feb 2 14:13:44 2011 -0800

    [trac517] make RBTreeNodeChain non copyable
    
    In the latest usage we don't need to copy RBTreeNodeChain objects.
    It would be safer to disable copy unless/until we see need for it.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/rbtree.h |   30 +++++++++---------------------
 1 files changed, 9 insertions(+), 21 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/rbtree.h b/src/lib/datasrc/rbtree.h
index 518d244..cf413e8 100644
--- a/src/lib/datasrc/rbtree.h
+++ b/src/lib/datasrc/rbtree.h
@@ -314,35 +314,23 @@ class RBTreeNodeChain {
 public:
     /// \name Constructors and Assignment Operator.
     ///
+    /// \note The copy constructor and the assignment operator are
+    /// intentionally defined as private, making this class non copyable.
+    /// This may have to be changed in a future version with newer need.
+    /// For now we explicitly disable copy to avoid accidental copy happens
+    /// unintentionally.
     //{@
     /// The default constructor.
     ///
     /// \exception None
     RBTreeNodeChain() : node_count_(0) {}
 
-    /// Copy constructor.
-    ///
-    /// \exception None
-    RBTreeNodeChain(const RBTreeNodeChain<T>& node_path) {
-        node_count_ = node_path.node_count_;
-        if (node_count_ > 0) {
-            memcpy(nodes_, node_path.nodes_, node_count_ * sizeof(RBNode<T>*));
-        }
-    }
-
-    /// Assignment operator.
-    ///
-    /// \exception None
-    RBTreeNodeChain<T>&
-    operator=(const RBTreeNodeChain<T>& node_path) {
-        node_count_ = node_path.node_count_;
-        if (node_count_ > 0) {
-            memcpy(nodes_, node_path.nodes_, node_count_ * sizeof(RBNode<T>*));
-        }
-        return (*this);
-    }
+private:
+    RBTreeNodeChain(const RBTreeNodeChain<T>&);
+    RBTreeNodeChain<T>& operator=(const RBTreeNodeChain<T>&);
     //@}
 
+public:
     /// \brief Return the number of levels stored in the chain.
     ///
     /// It's equal to the number of nodes in the chain; for an empty




More information about the bind10-changes mailing list