From: Otto Moerbeek Date: Wed, 17 Dec 2025 13:47:08 +0000 (+0100) Subject: Avoid a few cases of shadowing reported by g++-15 X-Git-Tag: rec-5.4.0-beta1~56^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5635d617f221861a313b1cd0bc556bdbaef508cd;p=thirdparty%2Fpdns.git Avoid a few cases of shadowing reported by g++-15 Signed-off-by: Otto Moerbeek --- diff --git a/pdns/tcounters.hh b/pdns/tcounters.hh index 39a99f04f4..3aea14bee5 100644 --- a/pdns/tcounters.hh +++ b/pdns/tcounters.hh @@ -203,11 +203,11 @@ template auto GlobalCounters::sum(Enum index) { auto lock = d_guarded.lock(); - auto sum = lock->d_history.at(index); + auto theSum = lock->d_history.at(index); for (const auto& instance : lock->d_instances) { - sum += instance->snapAt(index); + theSum += instance->snapAt(index); } - return sum; + return theSum; } // Average for a specific index @@ -219,14 +219,14 @@ auto GlobalCounters::avg(Enum index) { auto lock = d_guarded.lock(); auto wavg = lock->d_history.at(index); - auto sum = wavg.avg * wavg.weight; + auto theSum = wavg.avg * wavg.weight; auto count = wavg.weight; for (const auto& instance : lock->d_instances) { auto val = instance->snapAt(index); count += val.weight; - sum += val.avg * val.weight; + theSum += val.avg * val.weight; } - return count > 0 ? sum / count : 0; + return count > 0 ? theSum / count : 0; } // Max for a specific index @@ -237,11 +237,11 @@ template auto GlobalCounters::max(Enum index) { auto lock = d_guarded.lock(); - uint64_t max = 0; // ignore history + uint64_t theMax = 0; // ignore history for (const auto& instance : lock->d_instances) { - max = std::max(instance->snapAt(index), max); + theMax = std::max(instance->snapAt(index), theMax); } - return max; + return theMax; } // Get a consistent snap of *all* aggregated values