Skip to content

Commit bd34daf

Browse files
committed
refactor: use std::make_unique instead of raw new in WriterProperties
Replace raw new with std::make_unique for better exception safety and modern C++ best practices in WriterProperties::default_properties() and WriterProperties::FromMap(). Using std::make_unique provides: - Better exception safety (no leak if constructor throws) - More concise and readable code - Consistent with modern C++ guidelines
1 parent cf0fd37 commit bd34daf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/iceberg/file_writer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ Result<std::unique_ptr<Writer>> WriterFactoryRegistry::Open(
6060
}
6161

6262
std::unique_ptr<WriterProperties> WriterProperties::default_properties() {
63-
return std::unique_ptr<WriterProperties>(new WriterProperties());
63+
return std::make_unique<WriterProperties>();
6464
}
6565

6666
std::unique_ptr<WriterProperties> WriterProperties::FromMap(
6767
const std::unordered_map<std::string, std::string>& properties) {
68-
auto writer_properties = std::unique_ptr<WriterProperties>(new WriterProperties());
68+
auto writer_properties = std::make_unique<WriterProperties>();
6969
writer_properties->configs_ = properties;
7070
return writer_properties;
7171
}

0 commit comments

Comments
 (0)