From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 15:53:59 +0000 (+0100) Subject: cls_refcount.cc: use empty() instead of !size() to check for emptiness X-Git-Tag: v0.58~66^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=810d23e92f5ab8babb53ee38320fe73ca2316103;p=ceph.git 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 --- diff --git a/src/cls/refcount/cls_refcount.cc b/src/cls/refcount/cls_refcount.cc index c924c16e62f9..5e8edeb887af 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); }