From 50b930f283c33f01ce43c54216896e7d3736a1c9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Feb 2016 11:00:59 +0100 Subject: [PATCH] playlist/edit: use std::unique_ptr --- src/queue/PlaylistEdit.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/queue/PlaylistEdit.cxx b/src/queue/PlaylistEdit.cxx index 64f8ccd81..becaf1622 100644 --- a/src/queue/PlaylistEdit.cxx +++ b/src/queue/PlaylistEdit.cxx @@ -33,6 +33,8 @@ #include "SongLoader.hxx" #include "Idle.hxx" +#include + #include void @@ -128,14 +130,11 @@ playlist::AppendURI(PlayerControl &pc, const SongLoader &loader, const char *uri, Error &error) { - DetachedSong *song = loader.LoadSong(uri, error); + std::unique_ptr song(loader.LoadSong(uri, error)); if (song == nullptr) return 0; - unsigned result = AppendSong(pc, std::move(*song), error); - delete song; - - return result; + return AppendSong(pc, std::move(*song), error); } void