From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 16:20:19 +0000 (+0100) Subject: ceph_authtool.cc: use empty() instead of size() X-Git-Tag: v0.58~54^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d50a22d6a6466b8dc1c2fbd90a45a8cd295c520d;p=ceph.git ceph_authtool.cc: use empty() instead of size() 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(). warning from cppchecker was: [src/ceph_authtool.cc:124]: (performance) Possible inefficient checking for 'caps' emptiness. [src/ceph_authtool.cc:237]: (performance) Possible inefficient checking for 'caps' emptiness. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/ceph_authtool.cc b/src/ceph_authtool.cc index d4d205a4fa14..3075d9c69a78 100644 --- a/src/ceph_authtool.cc +++ b/src/ceph_authtool.cc @@ -121,7 +121,7 @@ int main(int argc, const char **argv) !add_key.empty() || list || !caps_fn.empty() || - caps.size() || + !caps.empty() || set_auid || print_key || create_keyring || @@ -234,7 +234,7 @@ int main(int argc, const char **argv) keyring.set_caps(ename, caps); modified = true; } - if (caps.size()) { + if (!caps.empty()) { keyring.set_caps(ename, caps); modified = true; }