From 4b242c26fca9e0b899519e4abe62291e1261ff35 Mon Sep 17 00:00:00 2001 From: 20dka Date: Wed, 14 Sep 2022 18:53:44 +0200 Subject: [PATCH] optimize function argument passing in GetPidVid, TServer::HandlePosition --- src/TServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TServer.cpp b/src/TServer.cpp index 92e9061..b9d7d2d 100644 --- a/src/TServer.cpp +++ b/src/TServer.cpp @@ -15,7 +15,7 @@ #include "Json.h" -static std::optional> GetPidVid(std::string str) { +static std::optional> GetPidVid(const std::string& str) { auto IDSep = str.find('-'); std::string pid = str.substr(0, IDSep); std::string vid = str.substr(IDSep + 1); @@ -425,7 +425,7 @@ void TServer::InsertClient(const std::shared_ptr& NewClient) { (void)mClients.insert(NewClient); } -void TServer::HandlePosition(TClient& c, std::string Packet) { +void TServer::HandlePosition(TClient& c, const std::string& Packet) { // Zp:serverVehicleID:data std::string withoutCode = Packet.substr(3); auto NameDataSep = withoutCode.find(':', 2);