From dcdcbe7d544c86bcc6bd46d43097b930c3746573 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 27 May 2019 13:54:35 +0200 Subject: [PATCH] Use for (const auto &i : collection) style loops --- pdns/syncres.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 3c6f3f1de8..e413ae1c33 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -694,9 +694,9 @@ vector SyncRes::getAddrs(const DNSName &qname, unsigned int depth, res_t resv4; // If IPv4 ever becomes second class, we should revisit this if (doResolve(qname, QType::A, resv4, depth+1, beenthere, newState) == 0) { // this consults cache, OR goes out - for (auto i = resv4.cbegin(); i != resv4.end(); ++i) { - if (i->d_type == QType::A) { - if (auto rec = getRR(*i)) { + for (auto const &i : resv4) { + if (i.d_type == QType::A) { + if (auto rec = getRR(i)) { ret.push_back(rec->getCA(53)); } } @@ -708,9 +708,9 @@ vector SyncRes::getAddrs(const DNSName &qname, unsigned int depth, newState = Indeterminate; res_t resv6; if (doResolve(qname, QType::AAAA, resv6, depth+1, beenthere, newState) == 0) { // this consults cache, OR goes out - for (auto i = resv6.cbegin(); i != resv6.end(); ++i) { - if (i->d_type == QType::AAAA) { - if (auto rec = getRR(*i)) + for (const auto &i : resv6) { + if (i.d_type == QType::AAAA) { + if (auto rec = getRR(i)) ret.push_back(rec->getCA(53)); } } @@ -720,9 +720,9 @@ vector SyncRes::getAddrs(const DNSName &qname, unsigned int depth, // Once IPv6 adoption matters, this needs to be revisited res_t cset; if (t_RC->get(d_now.tv_sec, qname, QType(QType::AAAA), false, &cset, d_cacheRemote) > 0) { - for (auto k = cset.cbegin(); k != cset.cend(); ++k) { - if (k->d_ttl > (unsigned int)d_now.tv_sec ) { - if (auto rec = getRR(*k)) { + for (const auto &i : cset) { + if (i.d_ttl > (unsigned int)d_now.tv_sec ) { + if (auto rec = getRR(i)) { ret.push_back(rec->getCA(53)); } } -- 2.47.2