diff options
author | Max Kellermann <max@duempel.org> | 2014-01-15 12:05:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-15 12:05:44 +0100 |
commit | 9fb82f9687c10ee8430437a97e263c85f968bddb (patch) | |
tree | 16ee0270c77e1a9662ac6ef3ba4e0959d5488f06 /src/PlaylistSong.cxx | |
parent | df80deb0708f9abe911dc3533c0d3b310f73650c (diff) | |
download | mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.tar.gz mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.tar.xz mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.zip |
DetachedSong: add method Update()
Don't create an intermediate Song instance when all we want is a
DetachedSong.
Diffstat (limited to 'src/PlaylistSong.cxx')
-rw-r--r-- | src/PlaylistSong.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
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) |