mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 17:19:09 +00:00
Fix: Unnecessary string duplication at StrMakeValid call sites
This commit is contained in:
@@ -486,7 +486,7 @@ static std::string ExtractString(char *buffer, size_t buffer_length)
|
||||
{
|
||||
size_t length = 0;
|
||||
for (; length < buffer_length && buffer[length] != '\0'; length++) {}
|
||||
return StrMakeValid(std::string(buffer, length));
|
||||
return StrMakeValid(std::string_view(buffer, length));
|
||||
}
|
||||
|
||||
bool TarScanner::AddFile(const std::string &filename, size_t, [[maybe_unused]] const std::string &tar_filename)
|
||||
|
@@ -284,7 +284,7 @@ void IniLoadFile::LoadFromDisk(const std::string &filename, Subdirectory subdir)
|
||||
if (!quoted && e == t) {
|
||||
item.value.reset();
|
||||
} else {
|
||||
item.value = StrMakeValid(std::string(t));
|
||||
item.value = StrMakeValid(std::string_view(t));
|
||||
}
|
||||
} else {
|
||||
/* it's an orphan item */
|
||||
|
Reference in New Issue
Block a user