From a654e07d11416ed5b3ea8d81b514349e01f60fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 30 Sep 2021 08:48:05 +0200 Subject: [PATCH] Eliminate a temporary std::string in ParsedFailed helper. Bug: None Change-Id: If3435b5e9da9d2049c9b82b8b68e54d1ecc69003 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233440 Reviewed-by: Mirko Bonadei Reviewed-by: Tommi Commit-Queue: Tommi Cr-Commit-Position: refs/heads/main@{#35125} --- pc/webrtc_sdp.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc index d5fcddba3a..6def54a346 100644 --- a/pc/webrtc_sdp.cc +++ b/pc/webrtc_sdp.cc @@ -415,7 +415,9 @@ static bool ParseFailed(absl::string_view message, RTC_LOG(LS_ERROR) << "Failed to parse: \"" << first_line << "\". Reason: " << description; if (error) { - error->line = std::string(first_line); + // TODO(bugs.webrtc.org/13220): In C++17, we can use plain assignment, with + // a string_view on the right hand side. + error->line.assign(first_line.data(), first_line.size()); error->description = std::move(description); } return false;