diff options
author | Max Kellermann <max@musicpd.org> | 2016-10-28 11:38:37 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-10-28 11:38:37 +0200 |
commit | 5b2b4bf13c73dc88a1b1c43651fb3e2c707227fd (patch) | |
tree | 143be3e3f9c16254076ed8c8bc61760d5c5768d1 | |
parent | 4bd67bc298fa5214eb2572d8a7c04ba0c24ac60b (diff) |
config/Param: use CamelCase
-rw-r--r-- | src/AudioConfig.cxx | 2 | ||||
-rw-r--r-- | src/Listen.cxx | 5 | ||||
-rw-r--r-- | src/LogInit.cxx | 6 | ||||
-rw-r--r-- | src/Main.cxx | 2 | ||||
-rw-r--r-- | src/Permission.cxx | 2 | ||||
-rw-r--r-- | src/ReplayGainConfig.cxx | 3 | ||||
-rw-r--r-- | src/config/ConfigFile.cxx | 10 | ||||
-rw-r--r-- | src/config/ConfigGlobal.cxx | 16 | ||||
-rw-r--r-- | src/config/ConfigGlobal.hxx | 6 | ||||
-rw-r--r-- | src/config/Data.hxx | 4 | ||||
-rw-r--r-- | src/config/Param.cxx | 4 | ||||
-rw-r--r-- | src/config/Param.hxx | 16 | ||||
-rw-r--r-- | src/neighbor/Glue.hxx | 1 | ||||
-rw-r--r-- | src/output/OutputPlugin.hxx | 2 | ||||
-rw-r--r-- | src/pcm/ConfiguredResampler.cxx | 4 |
15 files changed, 39 insertions, 44 deletions
diff --git a/src/AudioConfig.cxx b/src/AudioConfig.cxx index 561851c6b..221a90ead 100644 --- a/src/AudioConfig.cxx +++ b/src/AudioConfig.cxx @@ -39,7 +39,7 @@ getOutputAudioFormat(AudioFormat inAudioFormat) void initAudioConfig(void) { - const struct config_param *param = config_get_param(ConfigOption::AUDIO_OUTPUT_FORMAT); + const auto *param = config_get_param(ConfigOption::AUDIO_OUTPUT_FORMAT); if (param == nullptr) return; diff --git a/src/Listen.cxx b/src/Listen.cxx index 4bd865519..0f620325b 100644 --- a/src/Listen.cxx +++ b/src/Listen.cxx @@ -60,7 +60,7 @@ int listen_port; static bool listen_add_config_param(unsigned int port, - const struct config_param *param, + const ConfigParam *param, Error &error_r) { assert(param != nullptr); @@ -104,8 +104,7 @@ bool listen_global_init(EventLoop &loop, Partition &partition, Error &error) { int port = config_get_positive(ConfigOption::PORT, DEFAULT_PORT); - const struct config_param *param = - config_get_param(ConfigOption::BIND_TO_ADDRESS); + const auto *param = config_get_param(ConfigOption::BIND_TO_ADDRESS); listen_socket = new ClientListener(loop, partition); diff --git a/src/LogInit.cxx b/src/LogInit.cxx index cc617bdf9..5c8ae709b 100644 --- a/src/LogInit.cxx +++ b/src/LogInit.cxx @@ -124,18 +124,16 @@ log_init(bool verbose, bool use_stdout, Error &error) return true; #else - const struct config_param *param; - if (verbose) SetLogThreshold(LogLevel::DEBUG); - else if ((param = config_get_param(ConfigOption::LOG_LEVEL)) != nullptr) + else if (const auto ¶m = config_get_param(ConfigOption::LOG_LEVEL)) SetLogThreshold(parse_log_level(param->value.c_str(), param->line)); if (use_stdout) { return true; } else { - param = config_get_param(ConfigOption::LOG_FILE); + const auto *param = config_get_param(ConfigOption::LOG_FILE); if (param == nullptr) { #ifdef HAVE_SYSLOG /* no configuration: default to syslog (if diff --git a/src/Main.cxx b/src/Main.cxx index d3e141d2f..b82250fd4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -307,7 +307,7 @@ static void winsock_init(void) static void initialize_decoder_and_player(void) { - const struct config_param *param; + const ConfigParam *param; size_t buffer_size; param = config_get_param(ConfigOption::AUDIO_BUFFER_SIZE); diff --git a/src/Permission.cxx b/src/Permission.cxx index 38b0291d1..c874b977c 100644 --- a/src/Permission.cxx +++ b/src/Permission.cxx @@ -87,7 +87,7 @@ static unsigned parsePermissions(const char *string) void initPermissions(void) { unsigned permission; - const struct config_param *param; + const ConfigParam *param; permission_default = PERMISSION_READ | PERMISSION_ADD | PERMISSION_CONTROL | PERMISSION_ADMIN; diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx index 766ddea3a..bca0d6b6c 100644 --- a/src/ReplayGainConfig.cxx +++ b/src/ReplayGainConfig.cxx @@ -78,8 +78,7 @@ replay_gain_set_mode_string(const char *p) void replay_gain_global_init(void) { - const struct config_param *param = - config_get_param(ConfigOption::REPLAYGAIN); + const auto *param = config_get_param(ConfigOption::REPLAYGAIN); if (param != nullptr && !replay_gain_set_mode_string(param->value.c_str())) { diff --git a/src/config/ConfigFile.cxx b/src/config/ConfigFile.cxx index 490de0bed..9eca2ac9b 100644 --- a/src/config/ConfigFile.cxx +++ b/src/config/ConfigFile.cxx @@ -145,11 +145,11 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader, gcc_nonnull_all static void -Append(config_param *&head, config_param *p) +Append(ConfigParam *&head, ConfigParam *p) { assert(p->next == nullptr); - config_param **i = &head; + auto **i = &head; while (*i != nullptr) i = &(*i)->next; @@ -163,10 +163,10 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader, { const unsigned i = unsigned(o); const ConfigTemplate &option = config_param_templates[i]; - config_param *&head = config_data.params[i]; + auto *&head = config_data.params[i]; if (head != nullptr && !option.repeatable) { - struct config_param *param = head; + auto *param = head; throw FormatRuntimeError("config parameter \"%s\" is first defined " "on line %d and redefined on line %u\n", name, param->line, @@ -184,7 +184,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader, throw FormatRuntimeError("line %u: Unknown tokens after value", reader.GetLineNumber()); - auto *param = new config_param(value, reader.GetLineNumber()); + auto *param = new ConfigParam(value, reader.GetLineNumber()); Append(head, param); } diff --git a/src/config/ConfigGlobal.cxx b/src/config/ConfigGlobal.cxx index 23f356638..05290024b 100644 --- a/src/config/ConfigGlobal.cxx +++ b/src/config/ConfigGlobal.cxx @@ -75,10 +75,10 @@ void config_global_check(void) Check(*p); } -const config_param * +const ConfigParam * config_get_param(ConfigOption option) { - config_param *param = config_data.params[unsigned(option)]; + auto *param = config_data.params[unsigned(option)]; if (param != nullptr) param->used = true; return param; @@ -113,7 +113,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value) const char * config_get_string(ConfigOption option, const char *default_value) { - const struct config_param *param = config_get_param(option); + const auto *param = config_get_param(option); if (param == nullptr) return default_value; @@ -124,7 +124,7 @@ config_get_string(ConfigOption option, const char *default_value) AllocatedPath config_get_path(ConfigOption option, Error &error) { - const struct config_param *param = config_get_param(option); + const auto *param = config_get_param(option); if (param == nullptr) return AllocatedPath::Null(); @@ -132,7 +132,7 @@ config_get_path(ConfigOption option, Error &error) } AllocatedPath -config_parse_path(const struct config_param *param, Error & error) +config_parse_path(const ConfigParam *param, Error & error) { AllocatedPath path = ParsePath(param->value.c_str(), error); if (gcc_unlikely(path.IsNull())) @@ -145,7 +145,7 @@ config_parse_path(const struct config_param *param, Error & error) unsigned config_get_unsigned(ConfigOption option, unsigned default_value) { - const struct config_param *param = config_get_param(option); + const auto *param = config_get_param(option); long value; char *endptr; @@ -163,7 +163,7 @@ config_get_unsigned(ConfigOption option, unsigned default_value) unsigned config_get_positive(ConfigOption option, unsigned default_value) { - const struct config_param *param = config_get_param(option); + const auto *param = config_get_param(option); long value; char *endptr; @@ -184,7 +184,7 @@ config_get_positive(ConfigOption option, unsigned default_value) bool config_get_bool(ConfigOption option, bool default_value) { - const struct config_param *param = config_get_param(option); + const auto *param = config_get_param(option); bool success, value; if (param == nullptr) diff --git a/src/config/ConfigGlobal.hxx b/src/config/ConfigGlobal.hxx index 38c9d4d47..5d97302a3 100644 --- a/src/config/ConfigGlobal.hxx +++ b/src/config/ConfigGlobal.hxx @@ -26,7 +26,7 @@ class Error; class Path; class AllocatedPath; -struct config_param; +struct ConfigParam; struct ConfigBlock; void @@ -46,7 +46,7 @@ void ReadConfigFile(Path path); gcc_pure -const config_param * +const ConfigParam * config_get_param(enum ConfigOption option); gcc_pure @@ -90,7 +90,7 @@ config_get_path(enum ConfigOption option, Error &error); * not be parsed, returns AllocatedPath::Null() and sets the error. */ AllocatedPath -config_parse_path(const struct config_param *param, Error & error_r); +config_parse_path(const ConfigParam *param, Error & error_r); gcc_pure unsigned diff --git a/src/config/Data.hxx b/src/config/Data.hxx index ef4fc126c..20efec4ac 100644 --- a/src/config/Data.hxx +++ b/src/config/Data.hxx @@ -24,11 +24,11 @@ #include <array> -struct config_param; +struct ConfigParam; struct ConfigBlock; struct ConfigData { - std::array<config_param *, std::size_t(ConfigOption::MAX)> params; + std::array<ConfigParam *, std::size_t(ConfigOption::MAX)> params; std::array<ConfigBlock *, std::size_t(ConfigBlockOption::MAX)> blocks; void Clear(); diff --git a/src/config/Param.cxx b/src/config/Param.cxx index 9c292c6de..a3959c330 100644 --- a/src/config/Param.cxx +++ b/src/config/Param.cxx @@ -20,10 +20,10 @@ #include "config.h" #include "Param.hxx" -config_param::config_param(const char *_value, int _line) +ConfigParam::ConfigParam(const char *_value, int _line) :next(nullptr), value(_value), line(_line), used(false) {} -config_param::~config_param() +ConfigParam::~ConfigParam() { delete next; } diff --git a/src/config/Param.hxx b/src/config/Param.hxx index d66bd8aa3..469bcc79a 100644 --- a/src/config/Param.hxx +++ b/src/config/Param.hxx @@ -25,12 +25,12 @@ #include <string> -struct config_param { +struct ConfigParam { /** - * The next config_param with the same name. The destructor + * The next ConfigParam with the same name. The destructor * deletes the whole chain. */ - struct config_param *next; + ConfigParam *next; std::string value; @@ -42,17 +42,17 @@ struct config_param { */ bool used; - explicit config_param(int _line=-1) + explicit ConfigParam(int _line=-1) :next(nullptr), line(_line), used(false) {} gcc_nonnull_all - config_param(const char *_value, int _line=-1); + ConfigParam(const char *_value, int _line=-1); - config_param(const config_param &) = delete; + ConfigParam(const ConfigParam &) = delete; - ~config_param(); + ~ConfigParam(); - config_param &operator=(const config_param &) = delete; + ConfigParam &operator=(const ConfigParam &) = delete; /** * Determine if this is a "null" instance, i.e. an empty diff --git a/src/neighbor/Glue.hxx b/src/neighbor/Glue.hxx index aaa0b5dd3..61c07ef50 100644 --- a/src/neighbor/Glue.hxx +++ b/src/neighbor/Glue.hxx @@ -26,7 +26,6 @@ #include <forward_list> -struct config_param; class EventLoop; class NeighborExplorer; class NeighborListener; diff --git a/src/output/OutputPlugin.hxx b/src/output/OutputPlugin.hxx index 94a950d3a..71173ed29 100644 --- a/src/output/OutputPlugin.hxx +++ b/src/output/OutputPlugin.hxx @@ -145,7 +145,7 @@ struct AudioOutputPlugin { /** * The mixer plugin associated with this output plugin. This * may be nullptr if no mixer plugin is implemented. When - * created, this mixer plugin gets the same #config_param as + * created, this mixer plugin gets the same #ConfigParam as * this audio output device. */ const MixerPlugin *mixer_plugin; diff --git a/src/pcm/ConfiguredResampler.cxx b/src/pcm/ConfiguredResampler.cxx index f66bf8a3f..2af03c919 100644 --- a/src/pcm/ConfiguredResampler.cxx +++ b/src/pcm/ConfiguredResampler.cxx @@ -71,7 +71,7 @@ MakeResamplerDefaultConfig(ConfigBlock &block) * "resampler" block. */ static const ConfigBlock * -MigrateResamplerConfig(const config_param ¶m, ConfigBlock &block) +MigrateResamplerConfig(const ConfigParam ¶m, ConfigBlock &block) { assert(block.IsEmpty()); @@ -102,7 +102,7 @@ MigrateResamplerConfig(const config_param ¶m, ConfigBlock &block) } static const ConfigBlock * -MigrateResamplerConfig(const config_param *param, ConfigBlock &buffer) +MigrateResamplerConfig(const ConfigParam *param, ConfigBlock &buffer) { assert(buffer.IsEmpty()); |