Skip to content

Commit e5b00d2

Browse files
committed
refactor: use std::make_unique instead of raw new in ReaderProperties
Replace raw new with std::make_unique for better exception safety and modern C++ best practices in ReaderProperties::default_properties() and ReaderProperties::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 7e784dc commit e5b00d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/iceberg/file_reader.cc

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

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

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

0 commit comments

Comments
 (0)