From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 13:46:05 +0000 (+0100) Subject: monmaptool.cc: use empty() instead of size() to check for emptiness X-Git-Tag: v0.58~66^2~51 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dd855b3ee28a6ffc32d7a01819abb7cd40c00e6e;p=ceph.git monmaptool.cc: use empty() instead of size() to check for emptiness 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 --- diff --git a/src/monmaptool.cc b/src/monmaptool.cc index 5870e5f81ad1..e15e42b2ca82 100644 --- a/src/monmaptool.cc +++ b/src/monmaptool.cc @@ -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 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 removed; monmap.set_initial_members(g_ceph_context, initial_members,