unique_ptr/new to make_unique

The latter is easier to read and is the "correct" thing to do.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-08-20 23:03:22 -07:00
parent bedcf1cce5
commit 40c6a214e3
2 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ std::unique_ptr<Filter>
convert_filter_new(const AudioFormat in_audio_format, convert_filter_new(const AudioFormat in_audio_format,
const AudioFormat out_audio_format) const AudioFormat out_audio_format)
{ {
std::unique_ptr<ConvertFilter> filter(new ConvertFilter(in_audio_format)); auto filter = std::make_unique<ConvertFilter>(in_audio_format);
filter->Set(out_audio_format); filter->Set(out_audio_format);
return filter; return filter;
} }

View File

@ -158,7 +158,7 @@ TagBuilder::Commit() noexcept
std::unique_ptr<Tag> std::unique_ptr<Tag>
TagBuilder::CommitNew() noexcept TagBuilder::CommitNew() noexcept
{ {
std::unique_ptr<Tag> tag(new Tag()); auto tag = std::make_unique<Tag>();
Commit(*tag); Commit(*tag);
return tag; return tag;
} }