]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
obj_bencher.cc: use empty() instead of 'size() == 0' to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 16:22:41 +0000 (17:22 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:38 +0000 (10:27 -0800)
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().

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/common/obj_bencher.cc

index d75612311ba0d5962d7fd25bfe807fc9dd23ea62..54ed0db3f9228ec6bc08448c2b597aa548b3d9a7 100644 (file)
@@ -846,7 +846,7 @@ bool ObjBencher::more_objects_matching_prefix(const std::string& prefix, std::li
 
   objects->clear();
 
-  while (objects->size() == 0) {
+  while (objects->empty()) {
     bool objects_remain = get_objects(&unfiltered_objects, 20);
     if (!objects_remain)
       return false;
@@ -889,7 +889,7 @@ int ObjBencher::clean_up_slow(const std::string& prefix, int concurrentios) {
 
   //set up initial removes
   for (int i = 0; i < concurrentios; ++i) {
-    if (objects.size() == 0) {
+    if (objects.empty()) {
       // if there are fewer objects than concurrent ios, don't generate extras
       bool objects_found = more_objects_matching_prefix(prefix, &objects);
       if (!objects_found) {
@@ -941,7 +941,7 @@ int ObjBencher::clean_up_slow(const std::string& prefix, int concurrentios) {
     lock.Unlock();
 
     // get more objects if necessary
-    if (objects.size() == 0) {
+    if (objects.empty()) {
       objects_remain = more_objects_matching_prefix(prefix, &objects);
       // quit if there are no more
       if (!objects_remain) {