aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-11-29 12:12:39 +0100
committerFederico Angelilli <code@fedang.net>2024-11-29 12:12:39 +0100
commit8ad2993b9e6679a669b80154639b4941ed2fafb4 (patch)
tree4ec62786a4d549600f549e38d96b9b9a9ebe85b0 /src/config.c
parent32f4f9e071cb2a6966edaac512ae11598c5b1f7e (diff)
Refactor
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/config.c b/src/config.c
index ea59761..439a869 100644
--- a/src/config.c
+++ b/src/config.c
@@ -325,8 +325,7 @@ static bool config_read_list(const char *value, char ***result)
return true;
}
-static config_status_t config_read_block(const block_scheme_t *scheme, block_t *block, const char **type,
- const char *key, const char *value)
+static config_status_t config_read_block(block_t *block, const char **type, const char *key, const char *value)
{
const char *section = "block";
size_t index = 0;
@@ -342,10 +341,10 @@ static config_status_t config_read_block(const block_scheme_t *scheme, block_t *
status = config_read_entry(block_text_entries, block, &index, section, block->label, key, value);
*type = config_type_to_string(block_entries[index].type);
- if (status != CONFIG_UNKNOWN || scheme->entries == NULL)
+ if (status != CONFIG_UNKNOWN || block->scheme->entries == NULL)
return status;
- status = config_read_entry(scheme->entries, block, &index, section, block->label, key, value);
+ status = config_read_entry(block->scheme->entries, block, &index, section, block->label, key, value);
*type = config_type_to_string(block_entries[index].type);
return status;
}
@@ -544,8 +543,6 @@ int config_read(config_t *config, FILE *file)
bool bar_section = false;
action_t *action = NULL;
-
- const block_scheme_t *scheme = NULL;
block_t *block = NULL;
if (section != NULL) {
@@ -596,8 +593,7 @@ int config_read(config_t *config, FILE *file)
if (strcmp(block_schemes[i]->name, value))
continue;
- scheme = block_schemes[i];
- block = config_alloc_block(config, scheme, label);
+ block = config_alloc_block(config, block_schemes[i], label);
goto skip_pair;
}
@@ -668,7 +664,7 @@ int config_read(config_t *config, FILE *file)
}
if (block != NULL) {
- status = config_read_block(scheme, block, &type, key, value);
+ status = config_read_block(block, &type, key, value);
}
if (action != NULL) {