UICommon/NetPlayIndex: Take std::vector by const reference in ParseResponse()

This variable isn't std::moved anywhere and is just read out of into a
string. Instead of making a copy, and then another copy of the data into
a std::string, we can take it by reference, only copying the data once.
This commit is contained in:
Lioncash 2019-08-04 12:36:49 -04:00
parent 75f3656804
commit 8285a94d93
1 changed files with 4 additions and 3 deletions

View File

@ -25,13 +25,14 @@ NetPlayIndex::~NetPlayIndex()
Remove(); Remove();
} }
static std::optional<picojson::value> ParseResponse(std::vector<u8> response) static std::optional<picojson::value> ParseResponse(const std::vector<u8>& response)
{ {
std::string response_string(reinterpret_cast<char*>(response.data()), response.size()); const std::string response_string(reinterpret_cast<const char*>(response.data()),
response.size());
picojson::value json; picojson::value json;
auto error = picojson::parse(json, response_string); const auto error = picojson::parse(json, response_string);
if (!error.empty()) if (!error.empty())
return {}; return {};