]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/internal.cc: use !empty() instead of size()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 16:48:48 +0000 (17:48 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:39 +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/librbd/internal.cc

index fdadf6f6753f2c459cf6ba65068d193510c92b17..33b948d231043bd557c1426bbf2191263b38c1ad 100644 (file)
@@ -360,7 +360,7 @@ namespace librbd {
           it != images.end(); ++it) {
        names.push_back(it->first);
       }
-      if (images.size()) {
+      if (!images.empty()) {
        last_read = images.rbegin()->first;
       }
       r = images.size();
@@ -1056,7 +1056,7 @@ reprotect_and_return_err:
        return r;
       }
       omap_values.insert(outbl.begin(), outbl.end());
-      if (outbl.size() > 0)
+      if (!outbl.empty())
        last_read = outbl.rbegin()->first;
     } while (r == MAX_READ);
 
@@ -1074,7 +1074,7 @@ reprotect_and_return_err:
     librados::ObjectWriteOperation op;
     op.create(true);
     op.write_full(databl);
-    if (omap_values.size())
+    if (!omap_values.empty())
       op.omap_set(omap_values);
     r = io_ctx.operate(dst_oid, &op);
     if (r < 0) {