Skip to content

Commit 00d1294

Browse files
authored
refactor(storage): avoid initializing json object with empty initializer list (#15006)
1 parent d0fcdb4 commit 00d1294

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

google/cloud/storage/internal/patch_builder_details.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ nlohmann::json const& PatchBuilderDetails::GetPatch(
3636

3737
nlohmann::json const& PatchBuilderDetails::GetLabelsSubPatch(
3838
storage::BucketMetadataPatchBuilder const& patch) {
39-
static auto const* const kEmpty = [] { return new nlohmann::json({}); }();
39+
static auto const* const kEmpty = [] {
40+
return new nlohmann::json(nlohmann::json::object());
41+
}();
4042
if (!patch.labels_subpatch_dirty_) return *kEmpty;
4143
return GetPatch(patch.labels_subpatch_);
4244
}
@@ -53,7 +55,9 @@ nlohmann::json const& PatchBuilderDetails::GetPatch(
5355

5456
nlohmann::json const& PatchBuilderDetails::GetMetadataSubPatch(
5557
storage::ObjectMetadataPatchBuilder const& patch) {
56-
static auto const* const kEmpty = [] { return new nlohmann::json({}); }();
58+
static auto const* const kEmpty = [] {
59+
return new nlohmann::json(nlohmann::json::object());
60+
}();
5761
if (!patch.metadata_subpatch_dirty_) return *kEmpty;
5862
return GetPatch(patch.metadata_subpatch_);
5963
}

0 commit comments

Comments
 (0)