BIND 10 trac2292, updated. 536d25ae8f41c90653724a1ca453b290867461e5 [2292] Move the const_cast farther

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 1 15:03:45 UTC 2012


The branch, trac2292 has been updated
       via  536d25ae8f41c90653724a1ca453b290867461e5 (commit)
      from  6de9ca4708fe4e56e17aedab38b89d7f76bf2515 (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 536d25ae8f41c90653724a1ca453b290867461e5
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 1 17:02:45 2012 +0200

    [2292] Move the const_cast farther
    
    The plan is to move it away step by step from the internals of the tree
    and hope it'll get somewhere it is easy to deal with.

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

Summary of changes:
 src/lib/datasrc/memory/domaintree.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h
index 20f4693..172a0ae 100644
--- a/src/lib/datasrc/memory/domaintree.h
+++ b/src/lib/datasrc/memory/domaintree.h
@@ -1526,11 +1526,11 @@ DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
                   " and label sequence");
     }
 
-    DomainTreeNode<T>* node;
+    const DomainTreeNode<T>* node;
 
     if (!node_path.isEmpty()) {
         // Get the top node in the node chain
-        node = const_cast<DomainTreeNode<T>*>(node_path.top());
+        node = node_path.top();
         // Start searching from its down pointer
         node = node->getDown();
     } else {
@@ -1549,7 +1549,7 @@ DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
         if (relation == isc::dns::NameComparisonResult::EQUAL) {
             if (needsReturnEmptyNode_ || !node->isEmpty()) {
                 node_path.push(node);
-                *target = node;
+                *target = const_cast<DomainTreeNode<T>*>(node);
                 ret = EXACTMATCH;
             }
             break;
@@ -1562,7 +1562,7 @@ DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
             if (relation == isc::dns::NameComparisonResult::SUBDOMAIN) {
                 if (needsReturnEmptyNode_ || !node->isEmpty()) {
                     ret = PARTIALMATCH;
-                    *target = node;
+                    *target = const_cast<DomainTreeNode<T>*>(node);
                     if (callback != NULL &&
                         node->getFlag(DomainTreeNode<T>::FLAG_CALLBACK)) {
                         if ((callback)(*node, callback_arg)) {



More information about the bind10-changes mailing list