From 6fdced691630558d34654457a4410ea318848faf Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sat, 26 Sep 2020 11:26:37 +0300 Subject: [PATCH] mon: fixing extra copying in loops Signed-off-by: Ronen Friedman --- src/mon/ConnectionTracker.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mon/ConnectionTracker.cc b/src/mon/ConnectionTracker.cc index 7b01a102e90..4d7f5e45809 100644 --- a/src/mon/ConnectionTracker.cc +++ b/src/mon/ConnectionTracker.cc @@ -127,7 +127,7 @@ void ConnectionTracker::get_total_connection_score(int peer_rank, double *rating double rate = 0; int live = 0; - for (const auto i : peer_reports) { // loop through all the scores + for (const auto& i : peer_reports) { // loop through all the scores if (i.first == peer_rank) { // ... except the ones it has for itself, of course! continue; } @@ -252,7 +252,7 @@ void ConnectionTracker::dump(ceph::Formatter *f) const f->dump_float("half_life", half_life); f->dump_int("persist_interval", persist_interval); f->open_object_section("reports"); - for (auto i : peer_reports) { + for (const auto& i : peer_reports) { f->open_object_section("report"); i.second.dump(f); f->close_section(); -- 2.39.5