From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 17:06:41 +0000 (+0100) Subject: mds/MDSMap.cc: use !empty() instead of size() to check for emptiness X-Git-Tag: v0.58~66^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e57d9913f7e1079e3fe4b7f9528aaf16c85980a7;p=ceph.git mds/MDSMap.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/mds/MDSMap.cc b/src/mds/MDSMap.cc index 39fcd9312052..010ed286ea32 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -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::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 >& summary, } } } - if (laggy.size()) { + if (!laggy.empty()) { std::ostringstream oss; oss << "mds " << laggy << ((laggy.size() > 1) ? " are":" is")