From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 17:48:50 +0000 (+0100) Subject: src/client/SyntheticClient.cc: use !subdirs.empty() instead of size() X-Git-Tag: v0.58~54^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=adb807c8aeb71d798efb0369daa1ff084c059f9f;p=ceph.git src/client/SyntheticClient.cc: use !subdirs.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/client/SyntheticClient.cc:2706]: (performance) Possible inefficient checking for 'subdirs' emptiness Signed-off-by: Danny Al-Gaaf --- diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 30e31072f2bf..45c9d43cec3b 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -2703,7 +2703,7 @@ int SyntheticClient::random_walk(int num_req) } // descend? - if (.9*roll_die(::pow((double).9,(double)cwd.depth())) && subdirs.size()) { + if (.9*roll_die(::pow((double).9,(double)cwd.depth())) && !subdirs.empty()) { string s = get_random_subdir(); cwd.push_dentry( s ); dout(DBL) << "cd " << s << " -> " << cwd << dendl;