]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/lock/cls_lock.cc: use !lockers.empty() instead of size() 62/head
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 12 Feb 2013 17:51:51 +0000 (18:51 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 15 Feb 2013 20:55:09 +0000 (21:55 +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 cppchecker was:
[src/cls/lock/cls_lock.cc:209]: (performance) Possible inefficient
  checking for 'lockers' emptiness.

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

index 1405d87a1f2f2c9a9529880f093c942ddb908eb8..5f27c3cc4b1df30f2dbae808d1c483ee797853a1 100644 (file)
@@ -206,7 +206,7 @@ static int lock_obj(cls_method_context_t hctx,
     }
   }
 
-  if (lockers.size()) {
+  if (!lockers.empty()) {
     if (exclusive) {
       CLS_LOG(20, "could not exclusive-lock object, already locked");
       return -EBUSY;