]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_refcount.cc: use empty() instead of !size() to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 15:53:59 +0000 (16:53 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:38 +0000 (10:27 -0800)
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 <danny.al-gaaf@bisect.de>
src/cls/refcount/cls_refcount.cc

index c924c16e62f9077a13b13cd83eee2701c8bc297b..5e8edeb887af8fa83de2100d3c1f61d723361092 100644 (file)
@@ -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);
   }