From: Axel Viala Date: Wed, 14 Sep 2022 16:16:21 +0000 (+0200) Subject: [clang-tidy] Use nullptr explicitly and initialize directly. X-Git-Tag: dnsdist-1.8.0-rc1~221^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11968%2Fhead;p=thirdparty%2Fpdns.git [clang-tidy] Use nullptr explicitly and initialize directly. --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 557f621b82..e66fac6927 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -279,14 +279,14 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con catch (const PDNSException& e) { cout << "[Error] SOA lookup failed for zone '" << zone << "': " << e.reason << endl; numerrors++; - if (!sd.db) { + if (sd.db == nullptr) { return 1; } } catch (const std::exception& e) { cout << "[Error] SOA lookup failed for zone '" << zone << "': " << e.what() << endl; numerrors++; - if (!sd.db) { + if (sd.db == nullptr) { return 1; } } @@ -361,7 +361,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con pair::iterator,bool> ret; vector records; - if(!suppliedrecords) { + if(suppliedrecords == nullptr) { DNSResourceRecord drr; sd.db->list(zone, sd.domain_id, g_verbose); while(sd.db->get(drr)) { @@ -801,7 +801,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con for( const auto &rr : records ) { ok = ( rr.auth == 1 ); ds_ns = false; - done = (suppliedrecords || !sd.db->doesDNSSEC()); + done = (suppliedrecords != nullptr || !sd.db->doesDNSSEC()); for( const auto &qname : checkOcclusion ) { if( qname.second == QType::NS ) { if( qname.first == rr.qname ) { @@ -827,7 +827,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con cout << "[Warning] DS record without a delegation '" << rr.qname<<"'." << endl; numwarnings++; } - if( ! ok && ! suppliedrecords ) { + if( ! ok && suppliedrecords == nullptr ) { cout << "[Error] Following record is auth=" << rr.auth << ", run pdnsutil rectify-zone?: " << rr.qname << " IN " << rr.qtype.toString() << " " << rr.content << endl; numerrors++; } @@ -2218,7 +2218,8 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone) DomainInfo di; UeberBackend B("default"); - if(!B.getDomainInfo(zone, di, false) || !di.backend) { // di.backend and B are mostly identical + // di.backend and B are mostly identical + if(!B.getDomainInfo(zone, di, false) || di.backend == nullptr) { cerr<<"Can't find a zone called '"<getPrefix() == cmds.at(1)) @@ -4002,11 +4004,11 @@ try if (b->getPrefix() == cmds.at(2)) tgt = b; } - if (!src) { + if (src == nullptr) { cerr << "Unknown source backend '" << cmds.at(1) << "'" << endl; return 1; } - if (!tgt) { + if (tgt == nullptr) { cerr << "Unknown target backend '" << cmds.at(2) << "'" << endl; return 1; } @@ -4097,15 +4099,14 @@ try return 1; } - DNSBackend *db; - db = nullptr; + DNSBackend *db = nullptr; for(DNSBackend *b : BackendMakers().all()) { if (b->getPrefix() == cmds.at(1)) db = b; } - if (!db) { + if (db == nullptr) { cerr << "Unknown backend '" << cmds.at(1) << "'" << endl; return 1; }