]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
More Clang-Tidyze™
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 20 Oct 2025 15:33:35 +0000 (17:33 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 20 Oct 2025 16:29:21 +0000 (18:29 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/packethandler.hh
pdns/rfc2136handler.cc

index 4e5456cce26365af83e38862f680e5362fd42271..e1ba41e7c508c8cf6b50ec21e12525c63b191bc6 100644 (file)
@@ -92,8 +92,6 @@ private:
   void emitNSEC3(DNSPacket& p, std::unique_ptr<DNSPacket>& r, const NSEC3PARAMRecordContent &ns3prc, const DNSName& name, const string& namehash, const string& nexthash, int mode);
   int processUpdate(DNSPacket& p);
   int forwardPacket(const string &msgPrefix, const DNSPacket& p, const DomainInfo& di);
-  int checkUpdatePrescan(const DNSRecord *rr);
-  int checkUpdatePrerequisites(const DNSRecord *rr, DomainInfo *di);
 
   void makeNXDomain(DNSPacket& p, std::unique_ptr<DNSPacket>& r, const DNSName& target, const DNSName& wildcard);
   void makeNOError(DNSPacket& p, std::unique_ptr<DNSPacket>& r, const DNSName& target, const DNSName& wildcard, int mode);
index fd280ab3141b84376e8777d7376a396b74995f7c..233b84bf23e2c2322e76a5007763440501df4cea 100644 (file)
@@ -25,21 +25,21 @@ std::mutex PacketHandler::s_rfc2136lock;
 
 // Context data for RFC2136 operation
 struct updateContext {
-  const DomainInfo *di;
-  bool isPresigned;
+  const DomainInfo *di{nullptr};
+  bool isPresigned{false};
 
   // The following may be modified
-  bool narrow;
-  bool haveNSEC3;
-  NSEC3PARAMRecordContent ns3pr;
-  bool updatedSerial;
+  bool narrow{false};
+  bool haveNSEC3{false};
+  NSEC3PARAMRecordContent ns3pr{};
+  bool updatedSerial{false};
 };
 
 static void increaseSerial(const string& msgPrefix, const string& soaEditSetting, const updateContext& ctx);
 
 // Implement section 3.2.1 and 3.2.2 of RFC2136
 // NOLINTNEXTLINE(readability-identifier-length)
-int PacketHandler::checkUpdatePrerequisites(const DNSRecord* rr, DomainInfo* di)
+static int checkUpdatePrerequisites(const DNSRecord* rr, DomainInfo* di)
 {
   if (rr->d_ttl != 0) {
     return RCode::FormErr;
@@ -89,7 +89,7 @@ int PacketHandler::checkUpdatePrerequisites(const DNSRecord* rr, DomainInfo* di)
 
 // Method implements section 3.4.1 of RFC2136
 // NOLINTNEXTLINE(readability-identifier-length)
-int PacketHandler::checkUpdatePrescan(const DNSRecord* rr)
+static int checkUpdatePrescan(const DNSRecord* rr)
 {
   // The RFC stats that d_class != ZCLASS, but we only support the IN class.
   if (rr->d_class != QClass::IN && rr->d_class != QClass::NONE && rr->d_class != QClass::ANY) {
@@ -150,6 +150,7 @@ static bool mayPerformUpdate(const string& msgPrefix, const DNSRecord* rr, const
 // Caller has checked that we are allowed to insert the record and has handled
 // the NSEC3PARAM case already.
 // ctx is not const, may update updateSerial
+// NOLINTNEXTLINE(readability-function-cognitive-complexity)
 static uint performInsert(const string& msgPrefix, const DNSRecord* rr, updateContext& ctx, vector<DNSResourceRecord>& rrset, set<DNSName>& insnonterm, set<DNSName>& delnonterm) // NOLINT(readability-identifier-length)
 {
   uint changedRecords = 0;
@@ -409,6 +410,7 @@ static uint performInsert(const string& msgPrefix, const DNSRecord* rr, updateCo
 // the code that calls this performUpdate().
 // Caller has checked that we are allowed to delete the record and has handled
 // the NSEC3PARAM case already.
+// NOLINTNEXTLINE(readability-function-cognitive-complexity)
 static uint performDelete(const string& msgPrefix, const DNSRecord* rr, const updateContext& ctx, vector<DNSResourceRecord>& rrset, set<DNSName>& insnonterm, set<DNSName>& delnonterm) // NOLINT(readability-identifier-length)
 {
   vector<DNSResourceRecord> recordsToDelete;