From 810d23e92f5ab8babb53ee38320fe73ca2316103 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 16:53:59 +0100 Subject: [PATCH] cls_refcount.cc: use empty() instead of !size() to check for emptiness 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(). Signed-off-by: Danny Al-Gaaf --- src/cls/refcount/cls_refcount.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cls/refcount/cls_refcount.cc b/src/cls/refcount/cls_refcount.cc index c924c16e62f90..5e8edeb887af8 100644 --- a/src/cls/refcount/cls_refcount.cc +++ b/src/cls/refcount/cls_refcount.cc @@ -134,7 +134,7 @@ static int cls_rc_refcount_put(cls_method_context_t hctx, bufferlist *in, buffer if (ret < 0) return ret; - if (!objr.refs.size()) {// shouldn't happen! + if (objr.refs.empty()) {// shouldn't happen! CLS_LOG(0, "ERROR: cls_rc_refcount_put() was called without any references!\n"); return -EINVAL; } @@ -157,7 +157,7 @@ static int cls_rc_refcount_put(cls_method_context_t hctx, bufferlist *in, buffer objr.refs.erase(iter); - if (!objr.refs.size()) { + if (objr.refs.empty()) { return cls_cxx_remove(hctx); } -- 2.39.5