From 29b44666d5d15e8087ff4626483751222784c400 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 12 Feb 2013 18:51:51 +0100 Subject: [PATCH] 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 --- src/cls/lock/cls_lock.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cls/lock/cls_lock.cc b/src/cls/lock/cls_lock.cc index 1405d87a1f2f2..5f27c3cc4b1df 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; -- 2.39.5