MusicChunk, player/Thread: use std::unique_ptr<Tag>

This commit is contained in:
Max Kellermann
2017-12-20 14:43:29 +01:00
parent c6a95395b5
commit 25fa3ccade
7 changed files with 21 additions and 30 deletions

View File

@@ -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 *

View File

@@ -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