config/Param: use CamelCase

This commit is contained in:
Max Kellermann
2016-10-28 11:38:37 +02:00
parent 4bd67bc298
commit 5b2b4bf13c
15 changed files with 39 additions and 44 deletions

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -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