playlist/cue/CueParser: use std::unique_ptr
This commit is contained in:
@@ -22,20 +22,12 @@
|
||||
#include "util/Alloc.hxx"
|
||||
#include "util/StringUtil.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
#include "DetachedSong.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
CueParser::~CueParser()
|
||||
{
|
||||
delete current;
|
||||
delete previous;
|
||||
delete finished;
|
||||
}
|
||||
|
||||
static const char *
|
||||
cue_next_word(char *p, char **pp)
|
||||
{
|
||||
@@ -160,9 +152,9 @@ CueParser::Commit()
|
||||
assert(!current->GetTag().IsDefined());
|
||||
current->SetTag(song_tag.Commit());
|
||||
|
||||
finished = previous;
|
||||
previous = current;
|
||||
current = nullptr;
|
||||
finished = std::move(previous);
|
||||
previous = std::move(current);
|
||||
current.reset();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -237,7 +229,7 @@ CueParser::Feed2(char *p)
|
||||
}
|
||||
|
||||
state = TRACK;
|
||||
current = new DetachedSong(filename);
|
||||
current.reset(new DetachedSong(filename));
|
||||
assert(!current->GetTag().IsDefined());
|
||||
|
||||
song_tag = header_tag;
|
||||
@@ -297,11 +289,9 @@ CueParser::Get()
|
||||
deliver all remaining (partial) results */
|
||||
assert(current == nullptr);
|
||||
|
||||
finished = previous;
|
||||
previous = nullptr;
|
||||
finished = std::move(previous);
|
||||
previous.reset();
|
||||
}
|
||||
|
||||
DetachedSong *song = finished;
|
||||
finished = nullptr;
|
||||
return song;
|
||||
return finished.release();
|
||||
}
|
||||
|
Reference in New Issue
Block a user