Browse Source

[1198] proposed further refactor 6: we can even remove 'origin' (and thus
eliminating the need for making a copy of it)

JINMEI Tatuya 13 years ago
parent
commit
c05dc7099e
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/lib/datasrc/database.cc

+ 3 - 4
src/lib/datasrc/database.cc

@@ -631,18 +631,17 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
     // Try getting the final result and extract it
     // It is special if there's a CNAME or NS, DNAME is ignored here
     // And we don't consider the NS in origin
-    const Name origin(getOrigin());
+    const bool is_origin = (name == getOrigin());
     WantedTypes final_types(FINAL_TYPES());
     final_types.insert(type);
-    const FoundRRsets found = getRRsets(name.toText(), final_types,
-                                        name != origin);
+    const FoundRRsets found(getRRsets(name.toText(), final_types, !is_origin));
 
     // NS records, CNAME record and Wanted Type records
     const FoundIterator nsi(found.second.find(RRType::NS()));
     const FoundIterator cni(found.second.find(RRType::CNAME()));
     const FoundIterator wti(found.second.find(type));
 
-    if (name != origin && (options & FIND_GLUE_OK) == 0 &&
+    if (!is_origin && (options & FIND_GLUE_OK) == 0 &&
         nsi != found.second.end()) { // delegation at the exact node
         LOG_DEBUG(logger, DBG_TRACE_DETAILED,
                   DATASRC_DATABASE_FOUND_DELEGATION_EXACT).