Skip to content

Commit bf93649

Browse files
authored
chore(storage): minor corrections for performance while pushing back unreachable buckets to vector (#15803)
1 parent 569ea8a commit bf93649

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

google/cloud/storage/internal/bucket_requests.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ StatusOr<ListBucketsResponse> ListBucketsResponse::FromHttpResponse(
243243
result.items.emplace_back(std::move(*parsed));
244244
}
245245

246-
if (json.count("unreachable") != 0) {
247-
for (auto const& kv : json["unreachable"].items()) {
248-
result.unreachable.emplace_back(kv.value().get<std::string>());
249-
}
246+
auto const& unreachable = json["unreachable"];
247+
result.unreachable.reserve(unreachable.size());
248+
for (auto const& bucket : unreachable) {
249+
result.unreachable.push_back(bucket.get<std::string>());
250250
}
251251

252252
return result;

google/cloud/storage/well_known_parameters.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ struct RequestedPolicyVersion
595595
*
596596
* By default requests listing resources only includs the latest (live) version
597597
* of each resource, set this option to `true` to get list of unreachable
598-
* regions.
598+
* resources.
599599
*/
600600
struct ReturnPartialSuccess
601601
: public internal::WellKnownParameter<ReturnPartialSuccess, bool> {

0 commit comments

Comments
 (0)