From: Axel Viala Date: Wed, 14 Sep 2022 16:14:15 +0000 (+0200) Subject: [clang-tidy] use collection.empty() where possible in pdns_utils. X-Git-Tag: dnsdist-1.8.0-rc1~219^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88dd3a5735bf890112604cc0d894bddbf5482fa4;p=thirdparty%2Fpdns.git [clang-tidy] use collection.empty() where possible in pdns_utils. --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 557f621b82..de96f6101f 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -89,7 +89,7 @@ static void loadMainConfig(const std::string& configdir) exit(0); } - if(::arg()["config-name"]!="") + if(!::arg()["config-name"].empty()) g_programname+="-"+::arg()["config-name"]; string configname=::arg()["config-dir"]+"/"+g_programname+".conf"; @@ -1272,7 +1272,7 @@ static int editZone(const DNSName &zone) { for(const auto& c : changed) { cout< 0) { + if (!changed.empty()) { if (changed.find({zone, QType::SOA}) == changed.end()) { reAsk3:; cout< meta; - if (B.getDomainMetadata(zone, "TSIG-ALLOW-AXFR", meta) && meta.size() > 0) { + if (B.getDomainMetadata(zone, "TSIG-ALLOW-AXFR", meta) && !meta.empty()) { cout << "Zone has following allowed TSIG key(s): " << boost::join(meta, ",") << endl; } meta.clear(); - if (B.getDomainMetadata(zone, "AXFR-MASTER-TSIG", meta) && meta.size() > 0) { + if (B.getDomainMetadata(zone, "AXFR-MASTER-TSIG", meta) && !meta.empty()) { cout << "Zone uses following TSIG key(s): " << boost::join(meta, ",") << endl; } @@ -2203,7 +2203,7 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone) throw runtime_error("KSK key size must be equal to or greater than 0"); } - if (k_algo == "" && z_algo == "") { + if (k_algo.empty() && z_algo.empty()) { throw runtime_error("Zero algorithms given for KSK+ZSK in total"); } @@ -2229,13 +2229,13 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone) cerr<<"pdnsutil disable-dnssec "< domains; tgt->getAllDomains(&domains, false, true); - if (domains.size()>0) + if (!domains.empty()) throw PDNSException("Target backend has zone(s), please clean it first"); src->getAllDomains(&domains, false, true);