UICommon/NetPlayIndex: Move NetPlaySession variable closer to its usage point in List()

Moves it closer to where its used, narrowing its visible scope, as well
as preventing unnecessary std::string constructor executions in the
event invalid data is encountered (the continue branch).
This commit is contained in:
Lioncash 2019-08-04 12:24:01 -04:00
parent 13292563ee
commit 0a67a40e7c
1 changed files with 1 additions and 2 deletions

View File

@ -86,8 +86,6 @@ NetPlayIndex::List(const std::map<std::string, std::string>& filters)
for (const auto& entry : entries.get<picojson::array>()) for (const auto& entry : entries.get<picojson::array>())
{ {
NetPlaySession session;
const auto& name = entry.get("name"); const auto& name = entry.get("name");
const auto& region = entry.get("region"); const auto& region = entry.get("region");
const auto& method = entry.get("method"); const auto& method = entry.get("method");
@ -107,6 +105,7 @@ NetPlayIndex::List(const std::map<std::string, std::string>& filters)
continue; continue;
} }
NetPlaySession session;
session.name = name.to_str(); session.name = name.to_str();
session.region = region.to_str(); session.region = region.to_str();
session.game_id = game_id.to_str(); session.game_id = game_id.to_str();