[svn] commit: r3532 - /branches/trac397/src/bin/auth/rbt_datasrc.h

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Nov 16 09:25:39 UTC 2010


Author: hanfeng
Date: Tue Nov 16 09:25:39 2010
New Revision: 3532

Log:
fix the insert bug that if the node already exist return 1 otherwise return 0

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 16 09:25:39 2010
@@ -75,7 +75,7 @@
     
     /// \name Modify functions
     // \brief return the data stored in the node
-    void setData(T& data) { data_ = data;}
+    void setData(const T& data) { data_ = data;}
 
 private:
     /// \name Constructors and destructor
@@ -429,8 +429,14 @@
             if (new_node) {
                 *new_node = current;
             }
-            // if the node is non-ternimal, it does not exist, so we return 0
-            return (current->is_shadow_ ? 0 : 1);
+            // if the node is a common suffix not user inserted, return 0
+            // otherwise return 1
+            if (current->is_shadow_) {
+                current->is_shadow_ = false;
+                return 0;
+            } else {
+                return 1;
+            }
         } else {
             int common_label_count = compare_result.getCommonLabels();
             if (common_label_count == 1) {




More information about the bind10-changes mailing list