Skip to content

Commit

Permalink
Remove pessimizing std::move() calls. (#132)
Browse files Browse the repository at this point in the history
Found with -Wpessimizing-move.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
  • Loading branch information
PiotrSikora authored and mattklein123 committed Oct 12, 2016
1 parent 673bcc9 commit 799c697
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/common/http/access_log/access_log_formatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ FormatterPtr AccessLogFormatUtils::defaultAccessLogFormatter() {
}

FormatterImpl::FormatterImpl(const std::string& format) {
formatters_ = std::move(AccessLogFormatParser::parse(format));
formatters_ = AccessLogFormatParser::parse(format);
}

std::string FormatterImpl::format(const Http::HeaderMap& request_headers,
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/access_log/access_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ InstancePtr InstanceImpl::fromJson(Json::Object& json, Api::Api& api, Event::Dis
if (json.hasObject("format")) {
formatter.reset(new FormatterImpl(json.getString("format")));
} else {
formatter = std::move(AccessLogFormatUtils::defaultAccessLogFormatter());
formatter = AccessLogFormatUtils::defaultAccessLogFormatter();
}

return InstancePtr{new InstanceImpl(access_log_path, api, std::move(filter), std::move(formatter),
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/codec_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CodecClient::~CodecClient() {}
void CodecClient::close() { connection_->close(Network::ConnectionCloseType::NoFlush); }

void CodecClient::deleteRequest(ActiveRequest& request) {
connection_->dispatcher().deferredDelete(std::move(request.removeFromList(active_requests_)));
connection_->dispatcher().deferredDelete(request.removeFromList(active_requests_));
if (codec_client_callbacks_) {
codec_client_callbacks_->onStreamDestroy();
}
Expand Down
5 changes: 2 additions & 3 deletions source/common/http/conn_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ void ConnectionManagerImpl::destroyStream(ActiveStream& stream) {
}

if (!reset_stream) {
read_callbacks_->connection().dispatcher().deferredDelete(
std::move(stream.removeFromList(streams_)));
read_callbacks_->connection().dispatcher().deferredDelete(stream.removeFromList(streams_));
}

if (reset_stream && !(codec_->features() & CodecFeatures::Multiplexing)) {
Expand Down Expand Up @@ -642,7 +641,7 @@ void ConnectionManagerImpl::ActiveStream::onResetStream(StreamResetReason) {
}

connection_manager_.read_callbacks_->connection().dispatcher().deferredDelete(
std::move(removeFromList(connection_manager_.streams_)));
removeFromList(connection_manager_.streams_));
}

void ConnectionManagerImpl::ActiveStreamFilterBase::addResetStreamCallback(
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/http2/codec_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ int ConnectionImpl::onStreamClose(int32_t stream_id, uint32_t error_code) {
: StreamResetReason::RemoteReset);
}

connection_.dispatcher().deferredDelete(std::move(stream->removeFromList(active_streams_)));
connection_.dispatcher().deferredDelete(stream->removeFromList(active_streams_));
nghttp2_session_set_stream_user_data(session_, stream->stream_id_, nullptr);
}

Expand Down

0 comments on commit 799c697

Please sign in to comment.