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

index 39fcd9312052cc7ae05f86ba106d17b04b30348a..010ed286ea3249b6e0608581e77974e03a2d48e2 100644 (file)
@@ -194,7 +194,7 @@ void MDSMap::print(ostream& out)
        out << " '" << info.standby_for_name << "'";
       out << ")";
     }
-    if (info.export_targets.size())
+    if (!info.export_targets.empty())
       out << " export_targets=" << info.export_targets;
     out << "\n";    
   }
@@ -222,13 +222,13 @@ void MDSMap::print_summary(ostream& out)
 
   out << "e" << get_epoch() << ": " << up.size() << "/" << in.size() << "/" << max_mds << " up";
 
-  if (by_rank.size())
+  if (!by_rank.empty())
     out << " " << by_rank;
 
   for (map<string,int>::reverse_iterator p = by_state.rbegin(); p != by_state.rend(); p++)
     out << ", " << p->second << " " << p->first;
   
-  if (failed.size())
+  if (!failed.empty())
     out << ", " << failed.size() << " failed";
   //if (stopped.size())
   //out << ", " << stopped.size() << " stopped";
@@ -271,7 +271,7 @@ void MDSMap::get_health(list<pair<health_status_t,string> >& summary,
       }
     }
   }
-  if (laggy.size()) {
+  if (!laggy.empty()) {
     std::ostringstream oss;
     oss << "mds " << laggy
        << ((laggy.size() > 1) ? " are":" is")