]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mount/conf: avoid creating temporary object
authorKefu Chai <tchaikov@gmail.com>
Sat, 11 Jun 2022 07:49:42 +0000 (15:49 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 11 Jun 2022 07:49:42 +0000 (15:49 +0800)
commit798e58bd39267d66b8d5964bcedf80fa1cd9e53c
tree432d59bbfc3bb1a34d73bd5a5421e7874be528ad
parent01f9dc84826e9fd23f462cee8503e5339c8617dc
mount/conf: avoid creating temporary object

instead of creating an empty string and then mutating it, just
assign the return value of `eaddr.ip_n_port_to_str()` to it.
as C++17 enforces copy ellision in this case, we can avoid
two unnecessary calls here:

- creating a temporary object and destroying it.
- memcpy the temporary object.

also, after this change, the code is simpler.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/mount/conf.cc