Instance: remove Error parameter from GetDatabase()

This commit is contained in:
Max Kellermann 2016-10-26 18:52:00 +02:00
parent 086652dd50
commit 8d41e9658f
8 changed files with 11 additions and 18 deletions

View File

@ -35,15 +35,6 @@
#ifdef ENABLE_DATABASE
Database *
Instance::GetDatabase(Error &error)
{
if (database == nullptr)
error.Set(db_domain, int(DatabaseErrorCode::DISABLED),
"No database");
return database;
}
const Database &
Instance::GetDatabaseOrThrow() const
{

View File

@ -109,7 +109,9 @@ struct Instance final
* if this MPD configuration has no database (no
* music_directory was configured).
*/
Database *GetDatabase(Error &error);
Database *GetDatabase() {
return database;
}
/**
* Returns the global #Database instance. Throws

View File

@ -45,9 +45,9 @@ Partition::EmitIdle(unsigned mask)
#ifdef ENABLE_DATABASE
const Database *
Partition::GetDatabase(Error &error) const
Partition::GetDatabase() const
{
return instance.GetDatabase(error);
return instance.GetDatabase();
}
const Database &

View File

@ -183,7 +183,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
* if this MPD configuration has no database (no
* music_directory was configured).
*/
const Database *GetDatabase(Error &error) const;
const Database *GetDatabase() const;
gcc_pure
const Database &GetDatabaseOrThrow() const;

View File

@ -32,7 +32,7 @@
#ifdef ENABLE_DATABASE
SongLoader::SongLoader(const Client &_client)
:client(&_client), db(_client.GetDatabase(IgnoreError())),
:client(&_client), db(_client.GetDatabase()),
storage(_client.GetStorage()) {}
#endif

View File

@ -28,9 +28,9 @@ const Domain client_domain("client");
#ifdef ENABLE_DATABASE
const Database *
Client::GetDatabase(Error &error) const
Client::GetDatabase() const
{
return partition.instance.GetDatabase(error);
return partition.instance.GetDatabase();
}
const Database &

View File

@ -185,7 +185,7 @@ public:
* Wrapper for Instance::GetDatabase().
*/
gcc_pure
const Database *GetDatabase(Error &error) const;
const Database *GetDatabase() const;
/**
* Wrapper for Instance::GetDatabaseOrThrow().

View File

@ -131,7 +131,7 @@ DetachedSong::LoadFile(Path path)
}
const Database *
Client::GetDatabase(gcc_unused Error &error) const
Client::GetDatabase() const
{
return reinterpret_cast<const Database *>(this);
}