playlist/edit: use std::unique_ptr
This commit is contained in:
parent
cbeb809798
commit
50b930f283
@ -33,6 +33,8 @@
|
|||||||
#include "SongLoader.hxx"
|
#include "SongLoader.hxx"
|
||||||
#include "Idle.hxx"
|
#include "Idle.hxx"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -128,14 +130,11 @@ playlist::AppendURI(PlayerControl &pc, const SongLoader &loader,
|
|||||||
const char *uri,
|
const char *uri,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
DetachedSong *song = loader.LoadSong(uri, error);
|
std::unique_ptr<DetachedSong> song(loader.LoadSong(uri, error));
|
||||||
if (song == nullptr)
|
if (song == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unsigned result = AppendSong(pc, std::move(*song), error);
|
return AppendSong(pc, std::move(*song), error);
|
||||||
delete song;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user