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:
parent
75f3656804
commit
8285a94d93
|
@ -25,13 +25,14 @@ NetPlayIndex::~NetPlayIndex()
|
|||
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;
|
||||
|
||||
auto error = picojson::parse(json, response_string);
|
||||
const auto error = picojson::parse(json, response_string);
|
||||
|
||||
if (!error.empty())
|
||||
return {};
|
||||
|
|
Loading…
Reference in New Issue