]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
std::get removals 13555/head
authorRosen Penev <rosenp@gmail.com>
Tue, 5 Dec 2023 23:55:13 +0000 (15:55 -0800)
committerRosen Penev <rosenp@gmail.com>
Tue, 9 Jan 2024 00:09:26 +0000 (16:09 -0800)
Can be replaced by structured bindings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
pdns/lua-auth4.cc
pdns/pdnsutil.cc
pdns/statbag.cc

index 3efd2d7be7d5c82695727184b517a2b966fb4539..77f7caa9035e167ee32389af025cd075b4f2524c 100644 (file)
@@ -93,13 +93,11 @@ void AuthLua4::postLoad() {
 }
 
 bool AuthLua4::axfrfilter(const ComboAddress& remote, const DNSName& zone, const DNSResourceRecord& in, vector<DNSResourceRecord>& out) {
-  luacall_axfr_filter_t::result_type ret;
-  int rcode;
-
-  if (d_axfr_filter == nullptr) return false;
+  if (!d_axfr_filter) {
+    return false;
+  }
 
-  ret = d_axfr_filter(remote, zone, in);
-  rcode = std::get<0>(ret);
+  const auto& [rcode, rows] = d_axfr_filter(remote, zone, in);
   if (rcode < 0) {
     // no modification, handle normally
     return false;
@@ -114,8 +112,6 @@ bool AuthLua4::axfrfilter(const ComboAddress& remote, const DNSName& zone, const
   else
     throw PDNSException("Cannot understand return code "+std::to_string(rcode)+" in axfr filter response");
 
-  const auto& rows = std::get<1>(ret);
-
   try {
     for(const auto& row: rows) {
       DNSResourceRecord rec;
index 79f3476df4a0abca105a53cd157680cb6f28d613..15d241682e78651bd8c9d70beafcb3526551981e 100644 (file)
@@ -652,13 +652,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     }
   }
 
-  for (const auto &svcb : svcbTargets) {
-    const auto& name = std::get<0>(svcb);
-    const auto& target = std::get<2>(svcb);
-    auto prio = std::get<1>(svcb);
-    auto v4hintsAuto = std::get<3>(svcb);
-    auto v6hintsAuto = std::get<4>(svcb);
-
+  for (const auto& [name, prio, target, v4hintsAuto, v6hintsAuto] : svcbTargets) {
     if (name == target) {
       cout<<"[Error] SVCB record "<<name<<" has itself as target."<<endl;
       numerrors++;
@@ -690,13 +684,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, con
     }
   }
 
-  for (const auto &httpsRecord : httpsTargets) {
-    const auto& name = std::get<0>(httpsRecord);
-    const auto& target = std::get<2>(httpsRecord);
-    auto prio = std::get<1>(httpsRecord);
-    auto v4hintsAuto = std::get<3>(httpsRecord);
-    auto v6hintsAuto = std::get<4>(httpsRecord);
-
+  for (const auto& [name, prio, target, v4hintsAuto, v6hintsAuto] : httpsTargets) {
     if (name == target) {
       cout<<"[Error] HTTPS record "<<name<<" has itself as target."<<endl;
       numerrors++;
index 99046c62eaaa9a945bc1651bb3bd1bb99c6ef367..de8dfa2a69cb036f8f0123b2ca5263d2fb3c67ad 100644 (file)
@@ -263,15 +263,12 @@ vector<pair<string, unsigned int> > StatBag::getRing(const string &name)
   vector<pair<string, unsigned int> > ret;
 
   if (d_comboRings.count(name)) {
-    typedef pair<SComboAddress, unsigned int> stor_t;
-    vector<stor_t> raw =d_comboRings[name].lock()->get();
-    for(const stor_t& stor :  raw) {
-      ret.emplace_back(stor.first.ca.toString(), stor.second);
+    for (const auto& [addr, num] : d_comboRings[name].lock()->get()) {
+      ret.emplace_back(addr.ca.toString(), num);
     }
   } else if (d_dnsnameqtyperings.count(name)) {
-    auto raw = d_dnsnameqtyperings[name].lock()->get();
-    for (auto const &e : raw) {
-      ret.emplace_back(std::get<0>(e.first).toLogString() + "/" + std::get<1>(e.first).toString(), e.second);
+    for (auto const& [d, t] : d_dnsnameqtyperings[name].lock()->get()) {
+      ret.emplace_back(std::get<0>(d).toLogString() + "/" + std::get<1>(d).toString(), t);
     }
   }
   return ret;