1
0
mirror of https://github.com/citra-emu/citra.git synced 2024-12-23 12:20:05 +00:00

yuzu/game_list_worker: Move std::string construction after the termintion check in callbacks

Avoids potentially allocating a std::string instance when it isn't
needed.
This commit is contained in:
fearlessTobi 2018-12-07 16:53:15 +01:00
parent 5840943110
commit 5a625fe945

View File

@ -37,12 +37,13 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
const auto callback = [this, recursion, parent_dir](u64* num_entries_out, const auto callback = [this, recursion, parent_dir](u64* num_entries_out,
const std::string& directory, const std::string& directory,
const std::string& virtual_name) -> bool { const std::string& virtual_name) -> bool {
std::string physical_name = directory + DIR_SEP + virtual_name; if (stop_processing) {
// Breaks the callback loop.
return false;
}
if (stop_processing) const std::string physical_name = directory + DIR_SEP + virtual_name;
return false; // Breaks the callback loop. const bool is_dir = FileUtil::IsDirectory(physical_name);
bool is_dir = FileUtil::IsDirectory(physical_name);
if (!is_dir && HasSupportedFileExtension(physical_name)) { if (!is_dir && HasSupportedFileExtension(physical_name)) {
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
if (!loader) if (!loader)