aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-04 13:51:27 +0200
committerMax Kellermann <max@duempel.org>2013-08-04 14:07:50 +0200
commit65842cd99e82e30801bf287cd027c14e4ce3bd15 (patch)
tree13794e35372bde7e07e006bba87d1a66a9d4ea7f /src
parentbf6ed643e01687ed21b3a21cb3f77a1042e22c15 (diff)
downloadmpd-65842cd99e82e30801bf287cd027c14e4ce3bd15.tar.gz
mpd-65842cd99e82e30801bf287cd027c14e4ce3bd15.tar.xz
mpd-65842cd99e82e30801bf287cd027c14e4ce3bd15.zip
DatabasePlugin: pass config_param reference
Diffstat (limited to '')
-rw-r--r--src/DatabaseGlue.cxx4
-rw-r--r--src/DatabaseGlue.hxx2
-rw-r--r--src/DatabasePlugin.hxx2
-rw-r--r--src/Main.cxx2
-rw-r--r--src/db/ProxyDatabasePlugin.cxx12
-rw-r--r--src/db/SimpleDatabasePlugin.cxx6
-rw-r--r--src/db/SimpleDatabasePlugin.hxx4
7 files changed, 16 insertions, 16 deletions
diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx
index db7d4b9f3..e2076be28 100644
--- a/src/DatabaseGlue.cxx
+++ b/src/DatabaseGlue.cxx
@@ -50,13 +50,13 @@ static bool db_is_open;
static bool is_simple;
bool
-DatabaseGlobalInit(const config_param *param, GError **error_r)
+DatabaseGlobalInit(const config_param &param, GError **error_r)
{
assert(db == NULL);
assert(!db_is_open);
const char *plugin_name =
- config_get_block_string(param, "plugin", "simple");
+ param.GetBlockValue("plugin", "simple");
is_simple = strcmp(plugin_name, "simple") == 0;
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);
diff --git a/src/DatabaseGlue.hxx b/src/DatabaseGlue.hxx
index ea26f3242..e321e0ba8 100644
--- a/src/DatabaseGlue.hxx
+++ b/src/DatabaseGlue.hxx
@@ -32,7 +32,7 @@ class Database;
* @param param the database configuration block
*/
bool
-DatabaseGlobalInit(const config_param *param, GError **error_r);
+DatabaseGlobalInit(const config_param &param, GError **error_r);
void
DatabaseGlobalDeinit(void);
diff --git a/src/DatabasePlugin.hxx b/src/DatabasePlugin.hxx
index d7532ae0e..835244020 100644
--- a/src/DatabasePlugin.hxx
+++ b/src/DatabasePlugin.hxx
@@ -139,7 +139,7 @@ struct DatabasePlugin {
/**
* Allocates and configures a database.
*/
- Database *(*create)(const struct config_param *param,
+ Database *(*create)(const config_param &param,
GError **error_r);
};
diff --git a/src/Main.cxx b/src/Main.cxx
index 1cde2a908..c0824fc55 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -193,7 +193,7 @@ glue_db_init_and_load(void)
param = allocated;
}
- if (!DatabaseGlobalInit(param, &error))
+ if (!DatabaseGlobalInit(*param, &error))
MPD_ERROR("%s", error->message);
delete allocated;
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx
index 6acdb4170..ee557ed11 100644
--- a/src/db/ProxyDatabasePlugin.cxx
+++ b/src/db/ProxyDatabasePlugin.cxx
@@ -48,7 +48,7 @@ class ProxyDatabase : public Database {
Directory *root;
public:
- static Database *Create(const struct config_param *param,
+ static Database *Create(const config_param &param,
GError **error_r);
virtual bool Open(GError **error_r) override;
@@ -73,7 +73,7 @@ public:
GError **error_r) const override;
protected:
- bool Configure(const struct config_param *param, GError **error_r);
+ bool Configure(const config_param &param, GError **error_r);
};
G_GNUC_CONST
@@ -132,7 +132,7 @@ CheckError(struct mpd_connection *connection, GError **error_r)
}
Database *
-ProxyDatabase::Create(const struct config_param *param, GError **error_r)
+ProxyDatabase::Create(const config_param &param, GError **error_r)
{
ProxyDatabase *db = new ProxyDatabase();
if (!db->Configure(param, error_r)) {
@@ -144,10 +144,10 @@ ProxyDatabase::Create(const struct config_param *param, GError **error_r)
}
bool
-ProxyDatabase::Configure(const struct config_param *param, GError **)
+ProxyDatabase::Configure(const config_param &param, GError **)
{
- host = config_get_block_string(param, "host", "");
- port = config_get_block_unsigned(param, "port", 0);
+ host = param.GetBlockValue("host", "");
+ port = param.GetBlockValue("port", 0u);
return true;
}
diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx
index f8a176fe1..ac5a75438 100644
--- a/src/db/SimpleDatabasePlugin.cxx
+++ b/src/db/SimpleDatabasePlugin.cxx
@@ -41,7 +41,7 @@ simple_db_quark(void)
}
Database *
-SimpleDatabase::Create(const struct config_param *param, GError **error_r)
+SimpleDatabase::Create(const config_param &param, GError **error_r)
{
SimpleDatabase *db = new SimpleDatabase();
if (!db->Configure(param, error_r)) {
@@ -53,11 +53,11 @@ SimpleDatabase::Create(const struct config_param *param, GError **error_r)
}
bool
-SimpleDatabase::Configure(const struct config_param *param, GError **error_r)
+SimpleDatabase::Configure(const config_param &param, GError **error_r)
{
GError *error = NULL;
- char *_path = config_dup_block_path(param, "path", &error);
+ char *_path = param.DupBlockPath("path", &error);
if (_path == NULL) {
if (error != NULL)
g_propagate_error(error_r, error);
diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx
index 8f0ed214c..7250ea063 100644
--- a/src/db/SimpleDatabasePlugin.hxx
+++ b/src/db/SimpleDatabasePlugin.hxx
@@ -60,7 +60,7 @@ public:
return mtime;
}
- static Database *Create(const struct config_param *param,
+ static Database *Create(const config_param &param,
GError **error_r);
virtual bool Open(GError **error_r) override;
@@ -86,7 +86,7 @@ public:
GError **error_r) const override;
protected:
- bool Configure(const struct config_param *param, GError **error_r);
+ bool Configure(const config_param &param, GError **error_r);
gcc_pure
bool Check(GError **error_r) const;