From 9fb82f9687c10ee8430437a97e263c85f968bddb Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Jan 2014 12:05:44 +0100 Subject: DetachedSong: add method Update() Don't create an intermediate Song instance when all we want is a DetachedSong. --- src/PlaylistSong.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/PlaylistSong.cxx') diff --git a/src/PlaylistSong.cxx b/src/PlaylistSong.cxx index 4cd076eeb..4fbfb65a4 100644 --- a/src/PlaylistSong.cxx +++ b/src/PlaylistSong.cxx @@ -100,12 +100,11 @@ playlist_check_load_song(const DetachedSong *song, const char *uri, bool secure) if (uri_has_scheme(uri)) { dest = new DetachedSong(uri); } else if (PathTraitsUTF8::IsAbsolute(uri) && secure) { - Song *tmp = Song::LoadFile(uri, nullptr); - if (tmp == nullptr) + dest = new DetachedSong(uri); + if (!dest->Update()) { + delete dest; return nullptr; - - dest = new DetachedSong(*tmp); - delete tmp; + } } else { const Database *db = GetDatabase(); if (db == nullptr) -- cgit v1.2.3