From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 13:10:21 +0000 (+0100) Subject: OSDMonitor.h: use !reporters.empty() instead of size() X-Git-Tag: v0.58~66^2~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7705edfab5375adba49eb8f918fac24d6ec6132;p=ceph.git 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 --- diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index f35992c4312..05c484ed652 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();