MusicChunk, player/Thread: use std::unique_ptr<Tag>
This commit is contained in:
@@ -63,8 +63,8 @@ Tag::Merge(const Tag &base, const Tag &add) noexcept
|
||||
return builder.CommitNew();
|
||||
}
|
||||
|
||||
Tag *
|
||||
Tag::MergeReplace(Tag *base, Tag *add)
|
||||
std::unique_ptr<Tag>
|
||||
Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add)
|
||||
{
|
||||
if (add == nullptr)
|
||||
return base;
|
||||
@@ -72,11 +72,7 @@ Tag::MergeReplace(Tag *base, Tag *add)
|
||||
if (base == nullptr)
|
||||
return add;
|
||||
|
||||
Tag *tag = Merge(*base, *add).release();
|
||||
delete base;
|
||||
delete add;
|
||||
|
||||
return tag;
|
||||
return Merge(*base, *add);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@@ -126,8 +126,8 @@ struct Tag {
|
||||
*
|
||||
* @return a newly allocated tag
|
||||
*/
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
static Tag *MergeReplace(Tag *base, Tag *add);
|
||||
static std::unique_ptr<Tag> Merge(std::unique_ptr<Tag> base,
|
||||
std::unique_ptr<Tag> add);
|
||||
|
||||
/**
|
||||
* Returns the first value of the specified tag type, or
|
||||
|
Reference in New Issue
Block a user