mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 05:08:57 +00:00
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
1 changed files with 4 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue