]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Replace pairs of canonCompare calls with a single canonCompare_three_way.
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 26 Jun 2025 07:50:05 +0000 (09:50 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 26 Jun 2025 07:50:05 +0000 (09:50 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/bindbackend/bindbackend2.hh
pdns/zonemd.hh

index cc6658235dfed5babea00cfd420da6c14722330f..ae32f6115e50b6864cae05c5a0f3f13b2c04007a 100644 (file)
@@ -61,10 +61,9 @@ struct Bind2DNSRecord
   mutable bool auth;
   bool operator<(const Bind2DNSRecord& rhs) const
   {
-    if (qname.canonCompare(rhs.qname))
-      return true;
-    if (rhs.qname.canonCompare(qname))
-      return false;
+    if (int rc = qname.canonCompare_three_way(rhs.qname); rc != 0) {
+      return rc < 0;
+    }
     if (qtype == QType::SOA && rhs.qtype != QType::SOA)
       return true;
     return std::tie(qtype, content, ttl) < std::tie(rhs.qtype, rhs.content, rhs.ttl);
index 10dc2b600906f35fae86cd08f1c69aa07ef8c95e..7baf83e4d7f55d7f2e64fe5082298be0760103ab 100644 (file)
@@ -116,12 +116,8 @@ private:
   {
     bool operator()(const RRSetKey_t& lhs, const RRSetKey_t& rhs) const
     {
-      // FIXME surely we can be smarter here
-      if (lhs.first.canonCompare(rhs.first)) {
-        return true;
-      }
-      if (rhs.first.canonCompare(lhs.first)) {
-        return false;
+      if (int rc = lhs.first.canonCompare_three_way(rhs.first); rc != 0) {
+        return rc < 0;
       }
       return lhs.second < rhs.second;
     }