From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 18:07:33 +0000 (+0100) Subject: test_mon_workloadgen.cc: use empty() to check for emptiness X-Git-Tag: v0.58~66^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=37bb45f29ac16dcb52c817169441b3589ab6dafd;p=ceph.git test_mon_workloadgen.cc: use empty() to check for emptiness Use empty() instead of '!size()' and "size() == 0" to check for emptiness for performance reasons and since it's more logical. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/mon/test_mon_workloadgen.cc b/src/test/mon/test_mon_workloadgen.cc index e86d2851ac38..fa072dfeea51 100644 --- a/src/test/mon/test_mon_workloadgen.cc +++ b/src/test/mon/test_mon_workloadgen.cc @@ -477,7 +477,7 @@ class OSDStub : public TestStub } void auto_create_pgs() { - bool has_pgs = (pgs.size() > 0); + bool has_pgs = !pgs.empty(); dout(10) << __func__ << ": " << (has_pgs ? "has pgs; ignore" : "create pgs") << dendl; if (has_pgs) @@ -585,7 +585,7 @@ class OSDStub : public TestStub void modify_pgs() { dout(10) << __func__ << dendl; - if (pgs.size() == 0) { + if (pgs.empty()) { dout(1) << __func__ << " no pgs available! don't attempt to modify." << dendl; return; @@ -654,7 +654,7 @@ class OSDStub : public TestStub dout(10) << __func__ << dendl; modify_pgs(); - if (pgs_changes.size() > 0) + if (!pgs_changes.empty()) send_pg_stats(); monc.sub_want("osd_pg_creates", 0, CEPH_SUBSCRIBE_ONETIME); monc.renew_subs(); @@ -1033,7 +1033,7 @@ int main(int argc, const char *argv[]) } } - if (stub_ids.size() == 0) { + if (stub_ids.empty()) { std::cerr << "** error: must specify at least one '--stub-id '" << std::endl; usage();