From d7705edfab5375adba49eb8f918fac24d6ec6132 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 14:10:21 +0100 Subject: [PATCH] OSDMonitor.h: use !reporters.empty() instead of size() Use empty() since it should be prefered as it has, following the standard, a constant time complexity regardless of the containter type. The same is not guaranteed for size(). Using empty() in this case makes the code more logical. warning from cppcheck was: [src/mon/OSDMonitor.h:59]: (performance) Possible inefficient checking for 'reporters' emptiness. Signed-off-by: Danny Al-Gaaf --- src/mon/OSDMonitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index f35992c43121d..05c484ed65268 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -56,7 +56,7 @@ struct failure_info_t { failure_info_t() : num_reports(0) {} utime_t get_failed_since() { - if (max_failed_since == utime_t() && reporters.size()) { + if (max_failed_since == utime_t() && !reporters.empty()) { // the old max must have canceled; recalculate. for (map::iterator p = reporters.begin(); p != reporters.end(); -- 2.39.5