diff options
| author | bunnei <bunneidev@gmail.com> | 2018-08-09 19:29:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-09 19:29:36 -0400 |
| commit | 69cd213fac6b60dd044ec5598336c5b6cb201440 (patch) | |
| tree | 121dadb00f25d4bea8f7c04c79b8aef4bc411b7b /src/core/hle | |
| parent | 05c33d89a14a56cb47aec13d85697646533f8299 (diff) | |
| parent | 7353cfc7813c960e7fdb0b33829865c606f98c84 (diff) | |
Merge pull request #990 from lioncash/entry
fsp_srv: Emplace entries first when building index instead of emplacing last
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index e7ffb6bd1..1470f9017 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -193,13 +193,10 @@ private: template <typename T> static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vector<T>& new_data, FileSys::EntryType type) { + entries.reserve(entries.size() + new_data.size()); + for (const auto& new_entry : new_data) { - FileSys::Entry entry; - entry.filename[0] = '\0'; - std::strncat(entry.filename, new_entry->GetName().c_str(), FileSys::FILENAME_LENGTH - 1); - entry.type = type; - entry.file_size = new_entry->GetSize(); - entries.emplace_back(std::move(entry)); + entries.emplace_back(new_entry->GetName(), type, new_entry->GetSize()); } } |
