diff options
author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-02-07 20:14:34 +0100 |
---|---|---|
committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2013-02-11 11:38:02 +0100 |
commit | 76798eabea4d166ef8abd943b78769656a081531 (patch) | |
tree | 6e0450b99114cf4bbca76a5ca67359d4a6ca2c5e /src/osd/OSD.h | |
parent | 99f217503af033445ca2c39b0619836860fe4608 (diff) | |
download | ceph-76798eabea4d166ef8abd943b78769656a081531.tar.gz |
src/osd/OSD.h: use empty() instead of size()
Fix warning for usage 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().
warning from cppchecker was:
[osd/OSD.h:265]: (performance) Possible inefficient checking for
'last_scrub_pg' emptiness.
[osd/OSD.h:274]: (performance) Possible inefficient checking for
'last_scrub_pg' emptiness.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Diffstat (limited to 'src/osd/OSD.h')
-rw-r--r-- | src/osd/OSD.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osd/OSD.h b/src/osd/OSD.h index b411c177a36..03d78cc1cd6 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -262,7 +262,7 @@ public: } bool first_scrub_stamp(pair<utime_t, pg_t> *out) { Mutex::Locker l(sched_scrub_lock); - if (last_scrub_pg.size() == 0) + if (last_scrub_pg.empty()) return false; set< pair<utime_t, pg_t> >::iterator iter = last_scrub_pg.begin(); *out = *iter; @@ -271,7 +271,7 @@ public: bool next_scrub_stamp(pair<utime_t, pg_t> next, pair<utime_t, pg_t> *out) { Mutex::Locker l(sched_scrub_lock); - if (last_scrub_pg.size() == 0) + if (last_scrub_pg.empty()) return false; set< pair<utime_t, pg_t> >::iterator iter = last_scrub_pg.lower_bound(next); if (iter == last_scrub_pg.end()) |