]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid a few cases of shadowing reported by g++-15
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 17 Dec 2025 13:47:08 +0000 (14:47 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 17 Dec 2025 13:48:43 +0000 (14:48 +0100)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/tcounters.hh

index 39a99f04f4f1aacbe60b06e8bbe3e80934631cb0..3aea14bee54d4ac6b3de75b1a193ec318a0772dc 100644 (file)
@@ -203,11 +203,11 @@ template <typename Enum>
 auto GlobalCounters<Counters>::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<Counters>::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 <typename Enum>
 auto GlobalCounters<Counters>::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