also avoid using `map[key] = val` for setting an item in map, as, if
he 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 <tchaikov@gmail.com>
ObjectRef o = c->get_object(oid);
if (!o)
return -ENOENT;
- for (auto p = aset.begin(); p != aset.end(); ++p)
- o->xattr[p->first] = p->second;
+ for (auto&& [key, val]: aset) {
+ o->xattr.insert_or_assign(std::move(key), std::move(val));
+ }
return 0;
}