From bda77ffc5b0893a16983b4e3da5ced5beae1ab1f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 19 Nov 2018 19:19:20 +0100 Subject: db/Interface: remove IsPlugin(), use `dynamic_cast` instead --- src/command/StorageCommands.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/command/StorageCommands.cxx') diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx index cd016586a..ef779a318 100644 --- a/src/command/StorageCommands.cxx +++ b/src/command/StorageCommands.cxx @@ -209,12 +209,9 @@ handle_mount(Client &client, Request args, Response &r) instance.EmitIdle(IDLE_MOUNT); #ifdef ENABLE_DATABASE - Database *_db = instance.database; - if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) { - SimpleDatabase &db = *(SimpleDatabase *)_db; - + if (auto *db = dynamic_cast(instance.database)) { try { - db.Mount(local_uri, remote_uri); + db->Mount(local_uri, remote_uri); } catch (...) { composite.Unmount(local_uri); throw; @@ -256,11 +253,8 @@ handle_unmount(Client &client, Request args, Response &r) destroy here */ instance.update->CancelMount(local_uri); - Database *_db = instance.database; - if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) { - SimpleDatabase &db = *(SimpleDatabase *)_db; - - if (db.Unmount(local_uri)) + if (auto *db = dynamic_cast(instance.database)) { + if (db->Unmount(local_uri)) // TODO: call Instance::OnDatabaseModified()? instance.EmitIdle(IDLE_DATABASE); } -- cgit v1.2.3