From de095ded5cedaed3b7668142de59a2410018471d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Dec 2018 17:47:03 -0500 Subject: yuzu/game_list_worker: Don't retrieve file type and file type strings twice in MakeGameListEntry() While GetFileType() is indeed a getter function, that doesn't mean it's a trivial function, given some case require reading from the data or constructing other objects in the background. Instead, only do necessary work once. --- src/yuzu/game_list_worker.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 9fd074223..f16a6e41c 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -99,12 +99,14 @@ QList MakeGameListEntry(const std::string& path, const std::stri compatibility = it->second.first; } + const auto file_type = loader.GetFileType(); + const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type)); + QList list{ - new GameListItemPath( - FormatGameName(path), icon, QString::fromStdString(name), - QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id), + new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name), + file_type_string, program_id), new GameListItemCompat(compatibility), - new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))), + new GameListItem(file_type_string), new GameListItemSize(FileUtil::GetSize(path)), }; -- cgit v1.2.3