Skip to content

Commit 67ef949

Browse files
author
Duc Hieu Pham
committed
[easy] Avoid making a copy in a for loop
Summary: Clang has this warning (don't create copy in a loop), which makes sense, so we should fix it to get some perf win. Test Plan: unit test Reviewers: dhruba, igor, #sys-eng_team, #platform Reviewed By: igor, #sys-eng_team Differential Revision: https://rockset.phacility.com/D6692
1 parent 0820632 commit 67ef949

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cloud/aws/aws_s3.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ Status S3StorageProvider::PutCloudObjectMetadata(
675675
const std::unordered_map<std::string, std::string>& metadata) {
676676
Aws::S3::Model::PutObjectRequest request;
677677
Aws::Map<Aws::String, Aws::String> aws_metadata;
678-
for (const auto m : metadata) {
678+
for (const auto& m : metadata) {
679679
aws_metadata[ToAwsString(m.first)] = ToAwsString(m.second);
680680
}
681681
request.SetBucket(ToAwsString(bucket_name));
@@ -736,7 +736,7 @@ Status S3StorageProvider::HeadObject(
736736
}
737737
auto& res = outcome.GetResult();
738738
if (metadata != nullptr) {
739-
for (const auto m : res.GetMetadata()) {
739+
for (const auto& m : res.GetMetadata()) {
740740
(*metadata)[m.first.c_str()] = m.second.c_str();
741741
}
742742
}

0 commit comments

Comments
 (0)