1
0
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:
Jonathan G Rennison
2023-12-29 23:00:04 +00:00
parent 0d762a2bc1
commit 44cb143749
2 changed files with 2 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 */