From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 17:51:51 +0000 (+0100) Subject: cls/lock/cls_lock.cc: use !lockers.empty() instead of size() X-Git-Tag: v0.58~54^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29b44666d5d15e8087ff4626483751222784c400;p=ceph.git cls/lock/cls_lock.cc: use !lockers.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/cls/lock/cls_lock.cc:209]: (performance) Possible inefficient checking for 'lockers' emptiness. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/cls/lock/cls_lock.cc b/src/cls/lock/cls_lock.cc index 1405d87a1f2f..5f27c3cc4b1d 100644 --- a/src/cls/lock/cls_lock.cc +++ b/src/cls/lock/cls_lock.cc @@ -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;