Skip to content

Commit 361e602

Browse files
committed
Remove redundant string constructors
1 parent e6244f2 commit 361e602

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

ext/src/http/client/curl/http_client_curl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void Session::SendRequest(
134134
std::shared_ptr<opentelemetry::ext::http::client::EventHandler> callback) noexcept
135135
{
136136
is_session_active_.store(true, std::memory_order_release);
137-
std::string url = host_ + std::string(http_request_->uri_);
137+
const auto& url = host_ + http_request_->uri_;
138138
auto callback_ptr = callback.get();
139139
bool reuse_connection = false;
140140

ext/src/http/client/curl/http_operation_curl.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,7 @@ HttpOperation::HttpOperation(opentelemetry::ext::http::client::Method method,
301301
{
302302
for (auto &kv : this->request_headers_)
303303
{
304-
std::string header = std::string(kv.first);
305-
header += ": ";
306-
header += std::string(kv.second);
304+
const auto header = std::string(kv.first).append(": ").append(kv.second);
307305
curl_resource_.headers_chunk =
308306
curl_slist_append(curl_resource_.headers_chunk, header.c_str());
309307
}

0 commit comments

Comments
 (0)