mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-09-01 02:49:10 +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;
|
size_t length = 0;
|
||||||
for (; length < buffer_length && buffer[length] != '\0'; length++) {}
|
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)
|
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) {
|
if (!quoted && e == t) {
|
||||||
item.value.reset();
|
item.value.reset();
|
||||||
} else {
|
} else {
|
||||||
item.value = StrMakeValid(std::string(t));
|
item.value = StrMakeValid(std::string_view(t));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* it's an orphan item */
|
/* it's an orphan item */
|
||||||
|
Reference in New Issue
Block a user