]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
AuthMonitor.cc: use !pending_auth.empty() instead of 'size() > 0'
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 12:56:48 +0000 (13:56 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 12:59:18 +0000 (13:59 +0100)
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 cppcheck was:
[src/mon/AuthMonitor.cc:210]: (performance) Possible inefficient
  checking for 'pending_auth' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mon/AuthMonitor.cc

index e4cd752f29b2cc92f0d1ffe6fed455c597f7b474..ac54064d5689631f5db0e9771d1bf58230f402ae 100644 (file)
@@ -207,7 +207,7 @@ void AuthMonitor::increase_max_global_id()
 
 bool AuthMonitor::should_propose(double& delay)
 {
-  return (pending_auth.size() > 0);
+  return (!pending_auth.empty());
 }
 
 void AuthMonitor::create_pending()