db/DatabasePlaylist: pass Database reference around

Reduce global variable usage, move to frontend code.
This commit is contained in:
Max Kellermann
2014-02-01 01:11:50 +01:00
parent db69ceade6
commit 29072797ca
9 changed files with 53 additions and 27 deletions

View File

@@ -19,6 +19,7 @@
#include "config.h"
#include "PlaylistCommands.hxx"
#include "db/DatabaseGlue.hxx"
#include "db/DatabasePlaylist.hxx"
#include "CommandError.hxx"
#include "PlaylistPrint.hxx"
@@ -192,7 +193,11 @@ handle_playlistadd(Client &client, gcc_unused int argc, char *argv[])
success = spl_append_uri(playlist, loader, uri, error);
} else {
#ifdef ENABLE_DATABASE
success = search_add_to_playlist(uri, playlist, nullptr,
const Database *db = GetDatabase(error);
if (db == nullptr)
return print_error(client, error);
success = search_add_to_playlist(*db, uri, playlist, nullptr,
error);
#else
success = false;