]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2053] Remove loop to locate the start point
authorMukund Sivaraman <muks@isc.org>
Wed, 4 Jul 2012 03:54:48 +0000 (09:24 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 4 Jul 2012 03:54:48 +0000 (09:24 +0530)
src/lib/dns/labelsequence.cc

index c1db0004970d1a3d93e5f2dc8de29e9c8baf4880..6f07830cbbfe8dc97b08c5af623f0faa74d1bf04 100644 (file)
@@ -128,7 +128,8 @@ LabelSequence::toText(bool omit_final_dot) const {
         return (".");
     }
 
-    Name::NameString::const_iterator np = name_.ndata_.begin();
+    Name::NameString::const_iterator np = name_.ndata_.begin() +
+        name_.offsets_[first_label_];
     const Name::NameString::const_iterator np_end = name_.ndata_.end();
     // use for integrity check
     unsigned int labels = last_label_ - first_label_;
@@ -140,11 +141,6 @@ LabelSequence::toText(bool omit_final_dot) const {
     std::string result;
     result.reserve(name_.length_);
 
-    for (unsigned int i = 0; i < first_label_; i++) {
-        count = *np++;
-        np += count;
-    }
-
     while (np != np_end) {
         labels--;
         count = *np++;