Can be replaced by structured bindings.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
}
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;
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;
}
}
- 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++;
}
}
- 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++;
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;