From: Kefu Chai Date: Mon, 7 Jun 2021 06:54:02 +0000 (+0800) Subject: common/cmdparse: do not create temp string for cmd_getval() X-Git-Tag: v17.1.0~1713^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0893d18b4d20fb27779eb9c78233dff73e5caad8;p=ceph.git common/cmdparse: do not create temp string for cmd_getval() cmd_getval() consumes string_view, so no need to create a temporary std::string instance for it. Signed-off-by: Kefu Chai --- diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc index d02a2b99bbd1..90da6afef90d 100644 --- a/src/common/cmdparse.cc +++ b/src/common/cmdparse.cc @@ -578,7 +578,7 @@ bool validate_bool(CephContext *cct, { bool v; try { - if (!cmd_getval(cmdmap, string(name), v)) { + if (!cmd_getval(cmdmap, name, v)) { if (auto req = desc.find("req"); req != end(desc) && req->second == "false") { return true; @@ -607,7 +607,7 @@ bool validate_arg(CephContext* cct, { Value v; try { - if (!cmd_getval(cmdmap, string(name), v)) { + if (!cmd_getval(cmdmap, name, v)) { if constexpr (is_vector) { // an empty list is acceptable. return true;