From adb807c8aeb71d798efb0369daa1ff084c059f9f Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 18:48:50 +0100 Subject: [PATCH] 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 --- src/client/SyntheticClient.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 30e31072f2b..45c9d43cec3 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; -- 2.47.3