aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-01 00:45:58 +0100
committerMax Kellermann <max@duempel.org>2014-02-01 00:45:58 +0100
commit8cf4fb53aa102380a8e734590aa6e82920e9632c (patch)
tree3bd1353dd2310cdb9472a284900e1ad0d0e08a3c /src
parent1769ae54e4d1cf33e7528147f1ddf2f031228bd9 (diff)
downloadmpd-8cf4fb53aa102380a8e734590aa6e82920e9632c.tar.gz
mpd-8cf4fb53aa102380a8e734590aa6e82920e9632c.tar.xz
mpd-8cf4fb53aa102380a8e734590aa6e82920e9632c.zip
Playlist: pass Database to DatabaseModified()
Don't use global variable.
Diffstat (limited to '')
-rw-r--r--src/Instance.cxx3
-rw-r--r--src/Partition.cxx4
-rw-r--r--src/Partition.hxx2
-rw-r--r--src/Playlist.hxx3
-rw-r--r--src/PlaylistUpdate.cxx10
5 files changed, 9 insertions, 13 deletions
diff --git a/src/Instance.cxx b/src/Instance.cxx
index 621b0d669..229af0268 100644
--- a/src/Instance.cxx
+++ b/src/Instance.cxx
@@ -22,6 +22,7 @@
#include "Partition.hxx"
#include "Idle.hxx"
#include "Stats.hxx"
+#include "db/DatabaseGlue.hxx"
#ifdef ENABLE_DATABASE
@@ -35,7 +36,7 @@ void
Instance::DatabaseModified()
{
stats_invalidate();
- partition->DatabaseModified();
+ partition->DatabaseModified(*GetDatabase());
idle_add(IDLE_DATABASE);
}
diff --git a/src/Partition.cxx b/src/Partition.cxx
index f12f931be..4d4504338 100644
--- a/src/Partition.cxx
+++ b/src/Partition.cxx
@@ -25,9 +25,9 @@
#ifdef ENABLE_DATABASE
void
-Partition::DatabaseModified()
+Partition::DatabaseModified(const Database &db)
{
- playlist.DatabaseModified();
+ playlist.DatabaseModified(db);
}
#endif
diff --git a/src/Partition.hxx b/src/Partition.hxx
index 1faf7c9a2..de41162f3 100644
--- a/src/Partition.hxx
+++ b/src/Partition.hxx
@@ -178,7 +178,7 @@ struct Partition {
* The database has been modified. Propagate the change to
* all subsystems.
*/
- void DatabaseModified();
+ void DatabaseModified(const Database &db);
#endif
/**
diff --git a/src/Playlist.hxx b/src/Playlist.hxx
index 41811fe59..45f1e2dfc 100644
--- a/src/Playlist.hxx
+++ b/src/Playlist.hxx
@@ -26,6 +26,7 @@
enum TagType : uint8_t;
struct PlayerControl;
class DetachedSong;
+class Database;
class Error;
struct playlist {
@@ -141,7 +142,7 @@ public:
/**
* The database has been modified. Pull all updates.
*/
- void DatabaseModified();
+ void DatabaseModified(const Database &db);
#endif
PlaylistResult AppendSong(PlayerControl &pc,
diff --git a/src/PlaylistUpdate.cxx b/src/PlaylistUpdate.cxx
index 114305960..89132ca7b 100644
--- a/src/PlaylistUpdate.cxx
+++ b/src/PlaylistUpdate.cxx
@@ -19,7 +19,6 @@
#include "config.h"
#include "Playlist.hxx"
-#include "db/DatabaseGlue.hxx"
#include "db/DatabasePlugin.hxx"
#include "db/LightSong.hxx"
#include "DetachedSong.hxx"
@@ -56,17 +55,12 @@ UpdatePlaylistSong(const Database &db, DetachedSong &song)
}
void
-playlist::DatabaseModified()
+playlist::DatabaseModified(const Database &db)
{
- const Database *db = GetDatabase();
- if (db == nullptr)
- /* how can this ever happen? */
- return;
-
bool modified = false;
for (unsigned i = 0, n = queue.GetLength(); i != n; ++i) {
- if (UpdatePlaylistSong(*db, queue.Get(i))) {
+ if (UpdatePlaylistSong(db, queue.Get(i))) {
queue.ModifyAtPosition(i);
modified = true;
}