aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/DatabasePlaylist.cxx10
-rw-r--r--src/db/DatabasePlaylist.hxx6
-rw-r--r--src/db/DatabaseSong.cxx11
-rw-r--r--src/db/DatabaseSong.hxx3
4 files changed, 12 insertions, 18 deletions
diff --git a/src/db/DatabasePlaylist.cxx b/src/db/DatabasePlaylist.cxx
index 64b365d2a..814901227 100644
--- a/src/db/DatabasePlaylist.cxx
+++ b/src/db/DatabasePlaylist.cxx
@@ -21,7 +21,6 @@
#include "DatabasePlaylist.hxx"
#include "Selection.hxx"
#include "PlaylistFile.hxx"
-#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
@@ -37,17 +36,14 @@ AddSong(const char *playlist_path_utf8,
}
bool
-search_add_to_playlist(const char *uri, const char *playlist_path_utf8,
+search_add_to_playlist(const Database &db,
+ const char *uri, const char *playlist_path_utf8,
const SongFilter *filter,
Error &error)
{
- const Database *db = GetDatabase(error);
- if (db == nullptr)
- return false;
-
const DatabaseSelection selection(uri, true, filter);
using namespace std::placeholders;
const auto f = std::bind(AddSong, playlist_path_utf8, _1, _2);
- return db->Visit(selection, f, error);
+ return db.Visit(selection, f, error);
}
diff --git a/src/db/DatabasePlaylist.hxx b/src/db/DatabasePlaylist.hxx
index 1ee7584d3..5feafa190 100644
--- a/src/db/DatabasePlaylist.hxx
+++ b/src/db/DatabasePlaylist.hxx
@@ -22,12 +22,14 @@
#include "Compiler.h"
+class Database;
class SongFilter;
class Error;
-gcc_nonnull(1,2)
+gcc_nonnull(2,3)
bool
-search_add_to_playlist(const char *uri, const char *path_utf8,
+search_add_to_playlist(const Database &db,
+ const char *uri, const char *path_utf8,
const SongFilter *filter,
Error &error);
diff --git a/src/db/DatabaseSong.cxx b/src/db/DatabaseSong.cxx
index 592d38b85..f6229194b 100644
--- a/src/db/DatabaseSong.cxx
+++ b/src/db/DatabaseSong.cxx
@@ -19,23 +19,18 @@
#include "config.h"
#include "DatabaseSong.hxx"
-#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
DetachedSong *
-DatabaseDetachSong(const char *uri, Error &error)
+DatabaseDetachSong(const Database &db, const char *uri, Error &error)
{
- const Database *db = GetDatabase(error);
- if (db == nullptr)
- return nullptr;
-
- const LightSong *tmp = db->GetSong(uri, error);
+ const LightSong *tmp = db.GetSong(uri, error);
if (tmp == nullptr)
return nullptr;
DetachedSong *song = new DetachedSong(map_song_detach(*tmp));
- db->ReturnSong(tmp);
+ db.ReturnSong(tmp);
return song;
}
diff --git a/src/db/DatabaseSong.hxx b/src/db/DatabaseSong.hxx
index 0200af6b8..1197068bc 100644
--- a/src/db/DatabaseSong.hxx
+++ b/src/db/DatabaseSong.hxx
@@ -22,6 +22,7 @@
#include "Compiler.h"
+class Database;
class DetachedSong;
class Error;
@@ -33,6 +34,6 @@ class Error;
*/
gcc_malloc gcc_nonnull_all
DetachedSong *
-DatabaseDetachSong(const char *uri, Error &error);
+DatabaseDetachSong(const Database &db, const char *uri, Error &error);
#endif