Browse Source

[2096] Minor improvements

* Check for impossible return value and throw in that case.
* Call nextInternal directly, to avoid some indirection. This might
  cause a small performance benefit.
Michal 'vorner' Vaner 12 years ago
parent
commit
5b27cee6f2
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/lib/datasrc/memory/rdata_serialization.h

+ 5 - 3
src/lib/datasrc/memory/rdata_serialization.h

@@ -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);
             }