From 44cb1437499d0d111f41e0d07fa0fc45751a0f38 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 29 Dec 2023 23:00:04 +0000 Subject: [PATCH] Fix: Unnecessary string duplication at StrMakeValid call sites --- src/fileio.cpp | 2 +- src/ini_load.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index b0edd86b5c..215da0f36b 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -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) diff --git a/src/ini_load.cpp b/src/ini_load.cpp index cc7d681467..1a6eed76f5 100644 --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -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 */