From: Otto Moerbeek Date: Mon, 4 Nov 2024 08:41:15 +0000 (+0100) Subject: Tidy X-Git-Tag: rec-5.2.0-alpha1~2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=610d9aab8682a6353ff2d5d2ab86cb6803861104;p=thirdparty%2Fpdns.git Tidy --- diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index dbbfecb013..9fc6230740 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -1513,31 +1513,30 @@ vector* pleaseGetTimeouts() return ret; } -static string doGenericTopRemotes(pleaseremotefunc_t func) +static string doGenericTopRemotes(const pleaseremotefunc_t& func) { - typedef map counts_t; - counts_t counts; + std::map counts; - vector remotes = broadcastAccFunction>(func); + auto remotes = broadcastAccFunction>(func); unsigned int total = 0; - for (const ComboAddress& ca : remotes) { + for (const auto& address : remotes) { total++; - counts[ca]++; + counts[address]++; } - typedef std::multimap rcounts_t; - rcounts_t rcounts; - - for (auto&& c : counts) - rcounts.emplace(-c.second, c.first); + std::multimap rcounts; + for (auto& count : counts) { + rcounts.emplace(-count.second, count.first); + } ostringstream ret; ret << "Over last " << total << " entries:\n"; boost::format fmt("%.02f%%\t%s\n"); - int limit = 0, accounted = 0; - if (total) { - for (rcounts_t::const_iterator i = rcounts.begin(); i != rcounts.end() && limit < 20; ++i, ++limit) { + unsigned int limit = 0; + unsigned int accounted = 0; + if (total != 0) { + for (auto i = rcounts.begin(); i != rcounts.end() && limit < 20; ++i, ++limit) { ret << fmt % (-100.0 * i->first / total) % i->second.toString(); accounted += -i->first; }