]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monmaptool.cc: use empty() instead of size() to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 13:46:05 +0000 (14:46 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 13:46:05 +0000 (14:46 +0100)
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/monmaptool.cc

index 5870e5f81ad16aebd77da4210d51afaefba8afb1..e15e42b2ca8286888f0104db3a19626e23e49607 100644 (file)
@@ -91,7 +91,7 @@ int main(int argc, const char **argv)
       ++i;
     }
   }
-  if (args.size() < 1) {
+  if (args.empty()) {
     cerr << me << ": must specify monmap filename" << std::endl;
     usage();
   }
@@ -147,7 +147,7 @@ int main(int argc, const char **argv)
     // apply initial members
     list<string> initial_members;
     get_str_list(g_conf->mon_initial_members, initial_members);
-    if (initial_members.size()) {
+    if (!initial_members.empty()) {
       cout << "initial_members " << initial_members << ", filtering seed monmap" << std::endl;
       set<entity_addr_t> removed;
       monmap.set_initial_members(g_ceph_context, initial_members,