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/log_services.hpp b/redfish-core/lib/log_services.hpp
index bb9552a..ee57557 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -91,7 +91,7 @@
return nullptr;
}
-static const Message* getMessage(const std::string_view& messageID)
+static const Message* getMessage(std::string_view messageID)
{
// Redfish MessageIds are in the form
// RegistryName.MajorVersion.MinorVersion.MessageKey, so parse it to find
@@ -157,7 +157,7 @@
}
inline static int getJournalMetadata(sd_journal* journal,
- const std::string_view& field,
+ std::string_view field,
std::string_view& contents)
{
const char* data = nullptr;
@@ -179,8 +179,8 @@
}
inline static int getJournalMetadata(sd_journal* journal,
- const std::string_view& field,
- const int& base, long int& contents)
+ std::string_view field, const int& base,
+ long int& contents)
{
int ret = 0;
std::string_view metadata;
@@ -3321,8 +3321,7 @@
invalid,
};
-inline OEMDiagnosticType
- getOEMDiagnosticType(const std::string_view& oemDiagStr)
+inline OEMDiagnosticType getOEMDiagnosticType(std::string_view oemDiagStr)
{
if (oemDiagStr == "OnDemand")
{