From: Remi Gacogne Date: Mon, 17 Jul 2023 10:18:10 +0000 (+0200) Subject: auth: Apply Coverity's suggestion to prevent copies in loops w/ auto X-Git-Tag: rec-5.0.0-alpha1~98^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3317fbc0c1462a4f679f4e7c8315eef095ffa33;p=thirdparty%2Fpdns.git auth: Apply Coverity's suggestion to prevent copies in loops w/ auto --- diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index d455cb7ca7..d47904815d 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -1173,7 +1173,7 @@ bool LMDBBackend::replaceRRSet(uint32_t domain_id, const DNSName& qname, const Q if (!rrset.empty()) { vector adjustedRRSet; - for (auto rr : rrset) { + for (const auto& rr : rrset) { LMDBResourceRecord lrr(rr); lrr.content = serializeContent(lrr.qtype.getCode(), lrr.qname, lrr.content); lrr.qname.makeUsRelative(di.zone); @@ -2429,7 +2429,7 @@ bool LMDBBackend::updateDNSSECOrderNameAndAuth(uint32_t domain_id, const DNSName serFromString(val.get(), lrrs); bool changed = false; vector newRRs; - for (auto lrr : lrrs) { + for (auto& lrr : lrrs) { lrr.qtype = co.getQType(key.getNoStripHeader()); if (!needNSEC3 && qtype != QType::ANY) { needNSEC3 = (lrr.ordername && QType(qtype) != lrr.qtype); diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ac46da046f..54d02d35bb 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -872,7 +872,7 @@ static int checkAllZones(DNSSECKeeper &dk, bool exitOnError) B.getAllDomains(&domainInfo, true, true); int errors=0; - for(auto di : domainInfo) { + for (auto& di : domainInfo) { if (checkZone(dk, B, di.zone) > 0) { errors++; } diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index fe7fb50b0c..070d8c602e 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -1824,7 +1824,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) { // will be overridden by updateDomainSettingsFromDocument, if given in document. di.backend->setDomainMetadataOne(zonename, "SOA-EDIT-API", "DEFAULT"); - for(auto rr : new_records) { + for(auto& rr : new_records) { rr.domain_id = di.id; di.backend->feedRecord(rr, DNSName()); }