From ac2cf1b4df5325e68946782d3962cbb671d6ab50 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 24 Dec 2023 08:30:15 +0100 Subject: [PATCH] simplified the directory reader a little bit * we do not need to make a second allocation for the systemFilePath * as systemFilePath is never null, there is no need to check for that case. --- src/common/filesystem/source/file_directory.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common/filesystem/source/file_directory.cpp b/src/common/filesystem/source/file_directory.cpp index 8c9e304eaba..ea064eb0308 100644 --- a/src/common/filesystem/source/file_directory.cpp +++ b/src/common/filesystem/source/file_directory.cpp @@ -131,7 +131,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy } // for internal access we use the normalized form of the relative path. Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str()); - Entries[count].SystemFilePath = stringpool->Strdup(Entries[count].FileName); + Entries[count].SystemFilePath = FileName; Entries[count].CompressedSize = Entries[count].Length = entry.Length; Entries[count].Flags = RESFF_FULLPATH; Entries[count].ResourceID = -1; @@ -170,9 +170,7 @@ FileReader FDirectory::GetEntryReader(uint32_t entry, int readertype, int) if (entry < NumLumps) { std::string fn = mBasePath; - fn += Entries[entry].SystemFilePath ? - Entries[entry].SystemFilePath : - Entries[entry].FileName; + fn += Entries[entry].SystemFilePath; fr.OpenFile(fn.c_str()); if (readertype == READER_CACHED) {