]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2096] Minor improvements
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 24 Aug 2012 10:15:52 +0000 (12:15 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 24 Aug 2012 10:15:52 +0000 (12:15 +0200)
* Check for impossible return value and throw in that case.
* Call nextInternal directly, to avoid some indirection. This might
  cause a small performance benefit.

src/lib/datasrc/memory/rdata_serialization.h

index 4f6597183e702936716c1010572048e5efc47c09..085a6e3ab633fb1e83f48bca562865f1800137f3 100644 (file)
@@ -322,7 +322,7 @@ public:
     /// therefore if you already called next() yourself, it does not start
     /// at the beginning).
     void iterate() {
-        while (next() != RRSET_BOUNDARY) {}
+        while (nextInternal(name_action_, data_action_) != RRSET_BOUNDARY) {}
     }
 
     /// \brief Call next() until the end of current rdata.
@@ -334,7 +334,7 @@ public:
     /// \return If there was Rdata to iterate through.
     bool iterateRdata() {
         while (true) {
-            switch (next()) {
+            switch (nextInternal(name_action_, data_action_)) {
                 case NO_BOUNDARY: break;
                 case RDATA_BOUNDARY: return (true);
                 case RRSET_BOUNDARY: return (false);
@@ -365,7 +365,9 @@ public:
     bool iterateSingleSig() {
         while (true) {
             switch (nextSig()) {
-                case NO_BOUNDARY: break;
+                case NO_BOUNDARY:
+                    isc_throw(isc::Unexpected, "NO_BOUNDARY inside an RRSig. "
+                              "Data corruption? Bug inside RdataReader?");
                 case RDATA_BOUNDARY: return (true);
                 case RRSET_BOUNDARY: return (false);
             }