From cbeb80979891b91c87f384a11951661f63ed7fd3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Feb 2016 10:58:50 +0100 Subject: [PATCH] playlist/queue: use std::unique_ptr --- src/playlist/PlaylistQueue.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/playlist/PlaylistQueue.cxx b/src/playlist/PlaylistQueue.cxx index d3911b53f..0bd2133ef 100644 --- a/src/playlist/PlaylistQueue.cxx +++ b/src/playlist/PlaylistQueue.cxx @@ -33,6 +33,8 @@ #include "SongLoader.hxx" #endif +#include + bool playlist_load_into_queue(const char *uri, SongEnumerator &e, unsigned start_index, unsigned end_index, @@ -76,21 +78,18 @@ playlist_open_into_queue(const char *uri, Mutex mutex; Cond cond; - auto playlist = playlist_open_any(uri, + std::unique_ptr playlist(playlist_open_any(uri, #ifdef ENABLE_DATABASE - loader.GetStorage(), + loader.GetStorage(), #endif - mutex, cond); + mutex, cond)); if (playlist == nullptr) { error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST), "No such playlist"); return false; } - bool result = - playlist_load_into_queue(uri, *playlist, - start_index, end_index, - dest, pc, loader, error); - delete playlist; - return result; + return playlist_load_into_queue(uri, *playlist, + start_index, end_index, + dest, pc, loader, error); }