diff --git a/source/common/common/utility.cc b/source/common/common/utility.cc index 06a2a7027fc46..d5cd020ab8af7 100644 --- a/source/common/common/utility.cc +++ b/source/common/common/utility.cc @@ -194,7 +194,7 @@ void DateFormatter::parse(const std::string& format_string) { std::string DateFormatter::fromTimeAndPrepareSpecifierOffsets(time_t time, SpecifierOffsets& specifier_offsets, - const std::string& seconds_str) const { + const absl::string_view seconds_str) const { std::string formatted_time; int32_t previous = 0; @@ -435,7 +435,7 @@ std::string StringUtil::subspan(absl::string_view source, size_t start, size_t e return std::string(source.data() + start, end - start); } -std::string StringUtil::escape(const std::string& source) { +std::string StringUtil::escape(const absl::string_view source) { std::string ret; // Prevent unnecessary allocation by allocating 2x original size. diff --git a/source/common/common/utility.h b/source/common/common/utility.h index 24b29a1273500..b41286f8851f1 100644 --- a/source/common/common/utility.h +++ b/source/common/common/utility.h @@ -56,7 +56,7 @@ class DateFormatter { using SpecifierOffsets = std::vector; std::string fromTimeAndPrepareSpecifierOffsets(time_t time, SpecifierOffsets& specifier_offsets, - const std::string& seconds_str) const; + const absl::string_view seconds_str) const; // A container to hold a specifiers (%f, %Nf, %s) found in a format string. struct Specifier { @@ -404,7 +404,7 @@ class StringUtil { * @param source supplies the string to escape. * @return escaped string. */ - static std::string escape(const std::string& source); + static std::string escape(const absl::string_view source); /** * Outputs the string to the provided ostream, while escaping \n, \r, \t, and "