aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/DatabaseCommands.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/command/DatabaseCommands.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 '')
-rw-r--r--src/command/DatabaseCommands.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index 2b871e565..b458b3756 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -19,6 +19,7 @@
#include "config.h"
#include "DatabaseCommands.hxx"
+#include "db/DatabaseGlue.hxx"
#include "db/DatabaseQueue.hxx"
#include "db/DatabasePlaylist.hxx"
#include "db/DatabasePrint.hxx"
@@ -119,7 +120,11 @@ handle_searchaddpl(Client &client, int argc, char *argv[])
}
Error error;
- return search_add_to_playlist("", playlist, &filter, error)
+ const Database *db = GetDatabase(error);
+ if (db == nullptr)
+ return print_error(client, error);
+
+ return search_add_to_playlist(*db, "", playlist, &filter, error)
? CommandResult::OK
: print_error(client, error);
}