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/include/sessions.hpp b/include/sessions.hpp
index 19a1793..9795719 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -201,8 +201,7 @@
{
public:
std::shared_ptr<UserSession> generateUserSession(
- const std::string_view username,
- const boost::asio::ip::address& clientIp,
+ std::string_view username, const boost::asio::ip::address& clientIp,
const std::optional<std::string>& clientId,
PersistenceType persistence = PersistenceType::TIMEOUT,
bool isConfigureSelfOnly = false)
@@ -264,8 +263,7 @@
return it.first->second;
}
- std::shared_ptr<UserSession>
- loginSessionByToken(const std::string_view token)
+ std::shared_ptr<UserSession> loginSessionByToken(std::string_view token)
{
applySessionTimeouts();
if (token.size() != sessionTokenSize)
@@ -282,7 +280,7 @@
return userSession;
}
- std::shared_ptr<UserSession> getSessionByUid(const std::string_view uid)
+ std::shared_ptr<UserSession> getSessionByUid(std::string_view uid)
{
applySessionTimeouts();
// TODO(Ed) this is inefficient