diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-20 15:06:33 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-12-20 15:06:33 +0100 |
commit | 99f4bce1124898e6713da41bd2db1c4d97f12a76 (patch) | |
tree | 9eb1b16cf0967cae0115674623e2cd0195f554ce /src/IcyMetaDataParser.hxx | |
parent | 6b77ee9a5eacb7a49c7bcaf6e55d4459d0e501b9 (diff) |
IcyMetaDataParser: return std::unique_ptr<Tag>
Diffstat (limited to 'src/IcyMetaDataParser.hxx')
-rw-r--r-- | src/IcyMetaDataParser.hxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/IcyMetaDataParser.hxx b/src/IcyMetaDataParser.hxx index 178a2e252..5460d4382 100644 --- a/src/IcyMetaDataParser.hxx +++ b/src/IcyMetaDataParser.hxx @@ -20,9 +20,11 @@ #ifndef MPD_ICY_META_DATA_PARSER_HXX #define MPD_ICY_META_DATA_PARSER_HXX -#include <stddef.h> +#include "tag/Tag.hxx" + +#include <memory> -struct Tag; +#include <stddef.h> class IcyMetaDataParser { size_t data_size = 0, data_rest; @@ -30,7 +32,7 @@ class IcyMetaDataParser { size_t meta_size, meta_position; char *meta_data; - Tag *tag; + std::unique_ptr<Tag> tag; public: ~IcyMetaDataParser() noexcept { @@ -81,10 +83,8 @@ public: */ size_t ParseInPlace(void *data, size_t length) noexcept; - Tag *ReadTag() noexcept { - Tag *result = tag; - tag = nullptr; - return result; + std::unique_ptr<Tag> ReadTag() noexcept { + return std::exchange(tag, nullptr); } }; |