From: Miod Vallat Date: Thu, 26 Jun 2025 07:50:05 +0000 (+0200) Subject: Replace pairs of canonCompare calls with a single canonCompare_three_way. X-Git-Tag: rec-5.3.0-alpha2~40^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d8297a06a2e966a116d1bcc8bd2ebe7506a178f;p=thirdparty%2Fpdns.git Replace pairs of canonCompare calls with a single canonCompare_three_way. Signed-off-by: Miod Vallat --- diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index cc6658235d..ae32f6115e 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -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); diff --git a/pdns/zonemd.hh b/pdns/zonemd.hh index 10dc2b6009..7baf83e4d7 100644 --- a/pdns/zonemd.hh +++ b/pdns/zonemd.hh @@ -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; }