]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common: use string_view when appropriate 41234/head
authorKefu Chai <kchai@redhat.com>
Sat, 8 May 2021 08:43:55 +0000 (16:43 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 8 May 2021 08:46:00 +0000 (16:46 +0800)
the typical use case of get_val() passes a literal string as the key,
in that case, there is no need to create a std::string. as
md_config_t::get_val() always accepts a string_view as the option name.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/common/config_proxy.h

index f7611a6b4fc55c6f317932d72847eff4cb7f6f39..e56a6825f41c33945056845891cbfe3fe534b5c8 100644 (file)
@@ -125,11 +125,11 @@ public:
       }
     });
   }
-  int get_val(const std::string &key, std::string *val) const {
+  int get_val(std::string_view key, std::string *val) const {
     return get_config().get_val(*values, key, val);
   }
   template<typename T>
-  const T get_val(const std::string& key) const {
+  const T get_val(std::string_view key) const {
     return get_config().template get_val<T>(*values, key);
   }