aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongLoader.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-01 01:11:50 +0100
committerMax Kellermann <max@duempel.org>2014-02-04 00:57:43 +0100
commit29072797ca5a397b2878e458db22cb5dcc7dfe4d (patch)
tree442384db532c0d5d5affa5efa2c415efffe76c0e /src/SongLoader.cxx
parentdb69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9 (diff)
downloadmpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.tar.gz
mpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.tar.xz
mpd-29072797ca5a397b2878e458db22cb5dcc7dfe4d.zip
db/DatabasePlaylist: pass Database reference around
Reduce global variable usage, move to frontend code.
Diffstat (limited to 'src/SongLoader.cxx')
-rw-r--r--src/SongLoader.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/SongLoader.cxx b/src/SongLoader.cxx
index 2ed34671c..90df42824 100644
--- a/src/SongLoader.cxx
+++ b/src/SongLoader.cxx
@@ -92,11 +92,12 @@ SongLoader::LoadSong(const char *uri_utf8, Error &error) const
/* URI relative to the music directory */
#ifdef ENABLE_DATABASE
- return DatabaseDetachSong(uri_utf8, error);
-#else
+ if (db != nullptr)
+ return DatabaseDetachSong(*db, uri_utf8, error);
+#endif
+
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_SONG),
"No database");
return nullptr;
-#endif
}
}