aboutsummaryrefslogtreecommitdiffstats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/config/ConfigGlobal.cxx12
-rw-r--r--src/config/ConfigGlobal.hxx15
2 files changed, 8 insertions, 19 deletions
diff --git a/src/config/ConfigGlobal.cxx b/src/config/ConfigGlobal.cxx
index dd76e3ca3..9bc83398c 100644
--- a/src/config/ConfigGlobal.cxx
+++ b/src/config/ConfigGlobal.cxx
@@ -74,12 +74,10 @@ void config_global_check(void)
Check(p);
}
-const struct config_param *
-config_get_next_param(ConfigOption option, const struct config_param * last)
+const config_param *
+config_get_param(ConfigOption option)
{
- config_param *param = last != nullptr
- ? last->next
- : config_data.params[unsigned(option)];
+ config_param *param = config_data.params[unsigned(option)];
if (param != nullptr)
param->used = true;
return param;
@@ -88,8 +86,8 @@ config_get_next_param(ConfigOption option, const struct config_param * last)
const config_param *
config_find_block(ConfigOption option, const char *key, const char *value)
{
- const config_param *param = nullptr;
- while ((param = config_get_next_param(option, param)) != nullptr) {
+ for (const config_param *param = config_get_param(option);
+ param != nullptr; param = param->next) {
const char *value2 = param->GetBlockValue(key);
if (value2 == nullptr)
FormatFatalError("block without '%s' name in line %d",
diff --git a/src/config/ConfigGlobal.hxx b/src/config/ConfigGlobal.hxx
index 84ef7dd5f..831418d03 100644
--- a/src/config/ConfigGlobal.hxx
+++ b/src/config/ConfigGlobal.hxx
@@ -26,6 +26,7 @@
class Error;
class Path;
class AllocatedPath;
+struct config_param;
void config_global_init(void);
void config_global_finish(void);
@@ -39,19 +40,9 @@ void config_global_check(void);
bool
ReadConfigFile(Path path, Error &error);
-/* don't free the returned value
- set _last_ to nullptr to get first entry */
gcc_pure
-const struct config_param *
-config_get_next_param(enum ConfigOption option,
- const struct config_param *last);
-
-gcc_pure
-static inline const struct config_param *
-config_get_param(enum ConfigOption option)
-{
- return config_get_next_param(option, nullptr);
-}
+const config_param *
+config_get_param(enum ConfigOption option);
/**
* Find a block with a matching attribute.