From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 14:36:29 +0000 (+0100) Subject: rados.cc: use omap.empty() instead of size() to check for emptiness X-Git-Tag: v0.58~66^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95eda3267d79d3e2b6154883ede0faaa634c70d4;p=ceph.git rados.cc: use omap.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/rados.cc b/src/rados.cc index a850f874ac2d..d3de74a810b5 100644 --- a/src/rados.cc +++ b/src/rados.cc @@ -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);