]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rewrite some for(;;) loops as while loops. NFC
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 30 Jun 2025 06:58:06 +0000 (08:58 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 30 Jun 2025 08:12:14 +0000 (10:12 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc

index 2415554bc646115560370fdf3981a807e153f9e5..bc8908f88f56c1fafb8c23338577ba8dae726688 100644 (file)
@@ -2383,11 +2383,7 @@ bool LMDBBackend::getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& q
       // cout<<"hit end of zone find when we shouldn't"<<endl;
       return false;
     }
-    for (;;) {
-      if (isNSEC3BackRecord(lrr, key, val)) {
-        break;
-      }
-
+    while (!isNSEC3BackRecord(lrr, key, val)) {
       if (cursor.next(key, val) || co.getDomainID(key.getNoStripHeader<StringView>()) != id) {
         // cout<<"hit end of zone or database when we shouldn't"<<endl;
         return false;
@@ -2412,11 +2408,7 @@ bool LMDBBackend::getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& q
         // cout<<"hit end of zone find when we shouldn't for id "<<id<< __LINE__<<endl;
         return false;
       }
-      for (;;) {
-        if (isNSEC3BackRecord(lrr, key, val)) {
-          break;
-        }
-
+      while (!isNSEC3BackRecord(lrr, key, val)) {
         if (cursor.next(key, val) || co.getDomainID(key.getNoStripHeader<StringView>()) != id) {
           // cout<<"hit end of zone or database when we shouldn't" << __LINE__<<endl;
           return false;
@@ -2474,11 +2466,7 @@ bool LMDBBackend::getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& q
           // means database is wrong, nothing we can do
           return false;
         }
-        for (;;) {
-          if (isNSEC3BackRecord(lrr, key, val)) {
-            break;
-          }
-
+        while (!isNSEC3BackRecord(lrr, key, val)) {
           if (cursor.next(key, val)) {
             // means database is wrong, nothing we can do
             // cout<<"hit end of zone when we shouldn't 2"<<endl;
@@ -2508,11 +2496,7 @@ bool LMDBBackend::getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& q
         // means database is wrong, nothing we can do
         return false;
       }
-      for (;;) {
-        if (isNSEC3BackRecord(lrr, key, val)) {
-          break;
-        }
-
+      while (!isNSEC3BackRecord(lrr, key, val)) {
         if (cursor.next(key, val)) {
           // means database is wrong, nothing we can do
           // cout<<"hit end of zone when we shouldn't 2"<<endl;