From 4fa5538e2bed36903b403e1aaee2462d22b456dc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 21 Jan 2015 22:13:44 +0100 Subject: config/Param: split block-specific attributes to new struct ConfigBlock The old struct config_param remains only for top-level string options. --- src/input/Init.cxx | 16 ++++++++-------- src/input/InputPlugin.hxx | 4 ++-- src/input/plugins/CdioParanoiaInputPlugin.cxx | 6 +++--- src/input/plugins/CurlInputPlugin.cxx | 16 ++++++++-------- src/input/plugins/FfmpegInputPlugin.cxx | 2 +- src/input/plugins/NfsInputPlugin.cxx | 2 +- src/input/plugins/SmbclientInputPlugin.cxx | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/input') diff --git a/src/input/Init.cxx b/src/input/Init.cxx index 0debf6d43..4ed44f100 100644 --- a/src/input/Init.cxx +++ b/src/input/Init.cxx @@ -24,7 +24,7 @@ #include "util/Error.hxx" #include "config/ConfigGlobal.hxx" #include "config/ConfigOption.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "Log.hxx" #include @@ -33,7 +33,7 @@ bool input_stream_global_init(Error &error) { - const config_param empty; + const ConfigBlock empty; for (unsigned i = 0; input_plugins[i] != nullptr; ++i) { const InputPlugin *plugin = input_plugins[i]; @@ -42,17 +42,17 @@ input_stream_global_init(Error &error) assert(*plugin->name != 0); assert(plugin->open != nullptr); - const struct config_param *param = - config_find_block(ConfigOption::INPUT, "plugin", + const auto *block = + config_find_block(ConfigBlockOption::INPUT, "plugin", plugin->name); - if (param == nullptr) { - param = ∅ - } else if (!param->GetBlockValue("enabled", true)) + if (block == nullptr) { + block = ∅ + } else if (!block->GetBlockValue("enabled", true)) /* the plugin is disabled in mpd.conf */ continue; InputPlugin::InitResult result = plugin->init != nullptr - ? plugin->init(*param, error) + ? plugin->init(*block, error) : InputPlugin::InitResult::SUCCESS; switch (result) { diff --git a/src/input/InputPlugin.hxx b/src/input/InputPlugin.hxx index 17243c5c9..9e83c2a5f 100644 --- a/src/input/InputPlugin.hxx +++ b/src/input/InputPlugin.hxx @@ -34,7 +34,7 @@ #endif #endif -struct config_param; +struct ConfigBlock; class InputStream; class Error; struct Tag; @@ -69,7 +69,7 @@ struct InputPlugin { * @return true on success, false if the plugin should be * disabled */ - InitResult (*init)(const config_param ¶m, Error &error); + InitResult (*init)(const ConfigBlock &block, Error &error); /** * Global deinitialization. Called once before MPD shuts diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index 026d43077..dda5cb83f 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -31,7 +31,7 @@ #include "system/ByteOrder.hxx" #include "fs/AllocatedPath.hxx" #include "Log.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "config/ConfigError.hxx" #include @@ -106,9 +106,9 @@ static constexpr Domain cdio_domain("cdio"); static bool default_reverse_endian; static InputPlugin::InitResult -input_cdio_init(const config_param ¶m, Error &error) +input_cdio_init(const ConfigBlock &block, Error &error) { - const char *value = param.GetBlockValue("default_byte_order"); + const char *value = block.GetBlockValue("default_byte_order"); if (value != nullptr) { if (strcmp(value, "little_endian") == 0) default_reverse_endian = IsBigEndian(); diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index bdfcaf647..fb5845b2b 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -23,7 +23,7 @@ #include "../IcyInputStream.hxx" #include "../InputPlugin.hxx" #include "config/ConfigGlobal.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" #include "tag/Tag.hxx" #include "tag/TagBuilder.hxx" #include "event/SocketMonitor.hxx" @@ -535,7 +535,7 @@ CurlMulti::OnTimeout() */ static InputPlugin::InitResult -input_curl_init(const config_param ¶m, Error &error) +input_curl_init(const ConfigBlock &block, Error &error) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); if (code != CURLE_OK) { @@ -557,10 +557,10 @@ input_curl_init(const config_param ¶m, Error &error) http_200_aliases = curl_slist_append(http_200_aliases, "ICY 200 OK"); - proxy = param.GetBlockValue("proxy"); - proxy_port = param.GetBlockValue("proxy_port", 0u); - proxy_user = param.GetBlockValue("proxy_user"); - proxy_password = param.GetBlockValue("proxy_password"); + proxy = block.GetBlockValue("proxy"); + proxy_port = block.GetBlockValue("proxy_port", 0u); + proxy_user = block.GetBlockValue("proxy_user"); + proxy_password = block.GetBlockValue("proxy_password"); if (proxy == nullptr) { /* deprecated proxy configuration */ @@ -571,8 +571,8 @@ input_curl_init(const config_param ¶m, Error &error) ""); } - verify_peer = param.GetBlockValue("verify_peer", true); - verify_host = param.GetBlockValue("verify_host", true); + verify_peer = block.GetBlockValue("verify_peer", true); + verify_host = block.GetBlockValue("verify_host", true); CURLM *multi = curl_multi_init(); if (multi == nullptr) { diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx index 27260a5ea..444273d90 100644 --- a/src/input/plugins/FfmpegInputPlugin.cxx +++ b/src/input/plugins/FfmpegInputPlugin.cxx @@ -72,7 +72,7 @@ input_ffmpeg_supported(void) } static InputPlugin::InitResult -input_ffmpeg_init(gcc_unused const config_param ¶m, +input_ffmpeg_init(gcc_unused const ConfigBlock &block, Error &error) { FfmpegInit(); diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx index 48b86567c..077362c18 100644 --- a/src/input/plugins/NfsInputPlugin.cxx +++ b/src/input/plugins/NfsInputPlugin.cxx @@ -221,7 +221,7 @@ NfsInputStream::OnNfsFileError(Error &&error) */ static InputPlugin::InitResult -input_nfs_init(const config_param &, Error &) +input_nfs_init(const ConfigBlock &, Error &) { nfs_init(); return InputPlugin::InitResult::SUCCESS; diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index 258d1e917..6aab556f2 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -66,14 +66,14 @@ public: */ static InputPlugin::InitResult -input_smbclient_init(gcc_unused const config_param ¶m, Error &error) +input_smbclient_init(gcc_unused const ConfigBlock &block, Error &error) { if (!SmbclientInit(error)) return InputPlugin::InitResult::UNAVAILABLE; // TODO: create one global SMBCCTX here? - // TODO: evaluate config_param, call smbc_setOption*() + // TODO: evaluate ConfigBlock, call smbc_setOption*() return InputPlugin::InitResult::SUCCESS; } -- cgit v1.2.3