Parcourir la source

[1430] (unrelated cleanup) avoid calling getLabelCount() multiple times
unnecessarily.

JINMEI Tatuya il y a 13 ans
Parent
commit
4acc56d228
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/lib/datasrc/database.cc

+ 2 - 1
src/lib/datasrc/database.cc

@@ -585,7 +585,8 @@ DatabaseClient::Finder::findWildcardMatch(
     WantedTypes final_types(FINAL_TYPES());
     final_types.insert(type);
 
-    for (size_t i = 1; i <= (name.getLabelCount() - dresult.last_known); ++i) {
+    const size_t remove_labels = name.getLabelCount() - dresult.last_known;
+    for (size_t i = 1; i <= remove_labels; ++i) {
 
         // Strip off the left-more label(s) in the name and replace with a "*".
         const Name superdomain(name.split(i));