]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados.cc: use omap.empty() instead of size() to check for emptiness
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 14:36:29 +0000 (15:36 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:26:22 +0000 (10:26 -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/rados.cc

index a850f874ac2d417cd9e467090fd77695e4d5c351..d3de74a810b54c7c2e21936ee73722a1130852a2 100644 (file)
@@ -249,7 +249,7 @@ static int do_copy(IoCtx& io_ctx, const char *objname, IoCtx& target_ctx, const
   for (iter = attrset.begin(); iter != attrset.end(); ++iter) {
     write_op.setxattr(iter->first.c_str(), iter->second);
   }
-  if (omap.size()) {
+  if (!omap.empty()) {
     write_op.omap_set(omap);
   }
   ret = target_ctx.operate(target_oid, &write_op);
@@ -283,7 +283,7 @@ static int do_copy(IoCtx& io_ctx, const char *objname, IoCtx& target_ctx, const
     if (ret < 0)
       goto err;
 
-    if (!omap.size())
+    if (omap.empty())
       break;
 
     ret = target_ctx.omap_set(target_oid, omap);