diff options
author | Max Kellermann <max@duempel.org> | 2014-01-15 18:25:58 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-17 22:58:27 +0100 |
commit | 32ec6723115e9d534e3af685ea083bf74da5483d (patch) | |
tree | 22c9e08e08f80cda7556c4c2f105b831711085a7 /src/PlaylistFile.cxx | |
parent | e2812f722d04ca2f338e00d59d2a649545863b03 (diff) | |
download | mpd-32ec6723115e9d534e3af685ea083bf74da5483d.tar.gz mpd-32ec6723115e9d534e3af685ea083bf74da5483d.tar.xz mpd-32ec6723115e9d534e3af685ea083bf74da5483d.zip |
DatabaseSong: new library merging duplicate code
Diffstat (limited to '')
-rw-r--r-- | src/PlaylistFile.cxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index d4e357a45..2707bcb76 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -22,8 +22,7 @@ #include "PlaylistSave.hxx" #include "PlaylistInfo.hxx" #include "PlaylistVector.hxx" -#include "DatabasePlugin.hxx" -#include "DatabaseGlue.hxx" +#include "DatabaseSong.hxx" #include "DetachedSong.hxx" #include "Mapper.hxx" #include "fs/TextFile.hxx" @@ -405,18 +404,13 @@ spl_append_uri(const char *url, const char *utf8file, Error &error) return spl_append_song(utf8file, DetachedSong(url), error); } else { - const Database *db = GetDatabase(error); - if (db == nullptr) + DetachedSong *song = DatabaseDetachSong(url, error); + if (song == nullptr) return false; - Song *tmp = db->GetSong(url, error); - if (tmp == nullptr) - return false; - - const DetachedSong song(*tmp); - db->ReturnSong(tmp); - - return spl_append_song(utf8file, song, error); + bool success = spl_append_song(utf8file, *song, error); + delete song; + return success; } } |