]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: use structured binding in loop 42921/head
authorKefu Chai <kchai@redhat.com>
Wed, 25 Aug 2021 14:25:54 +0000 (22:25 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 25 Aug 2021 14:25:55 +0000 (22:25 +0800)
also avoid using `map[key] = val` for setting an item in map, as, if
the key does not exist in map, `map[key]` would have to create a value
using its default ctor, and then call the `operator=(bufferlist&&)` to
set it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/cyanstore/cyan_store.cc

index 149f87328a156979614d77a0c96e2b630848b833..a7c89d2d2af5823402e6685b0f96b2e11c8d91b9 100644 (file)
@@ -575,8 +575,8 @@ int CyanStore::_omap_set_values(
     return -ENOENT;
 
   ObjectRef o = c->get_or_create_object(oid);
-  for (auto &&i: aset) {
-    o->omap[std::move(i.first)] = std::move(i.second);
+  for (auto&& [key, val]: aset) {
+    o->omap.insert_or_assign(std::move(key), std::move(val));
   }
   return 0;
 }