Pass string views by value
string_view should always be passed by value; This commit is a sed
replace of the code to make all string_views pass by value, per general
coding guidelines[1].
[1] https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I55b342a29a0fbfce0a4ed9ea63db6014d03b134c
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 16f26e3..93cb366 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -148,7 +148,7 @@
* @return None
*/
static void updateCertIssuerOrSubject(nlohmann::json& out,
- const std::string_view value)
+ std::string_view value)
{
// example: O=openbmc-project.xyz,CN=localhost
std::string_view::iterator i = value.begin();
@@ -163,16 +163,14 @@
{
break;
}
- const std::string_view key(tokenBegin,
- static_cast<size_t>(i - tokenBegin));
+ std::string_view key(tokenBegin, static_cast<size_t>(i - tokenBegin));
++i;
tokenBegin = i;
while (i != value.end() && *i != ',')
{
++i;
}
- const std::string_view val(tokenBegin,
- static_cast<size_t>(i - tokenBegin));
+ std::string_view val(tokenBegin, static_cast<size_t>(i - tokenBegin));
if (key == "L")
{
out["City"] = val;