From 76ad6b0d404d40f08b73d90ac5f66564c29feb95 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 24 Nov 2024 17:40:26 +0100 Subject: Refactor config parser --- src/action.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/action.c') diff --git a/src/action.c b/src/action.c index 81995e6..0ae0c0a 100644 --- a/src/action.c +++ b/src/action.c @@ -9,6 +9,7 @@ void action_perform(action_t *action, block_t *block, config_t *config) { block_t *target = block; + bool warned = false; for (size_t i = 0; i < action->length; i++) { const char *key = action->parts[i].key; @@ -29,19 +30,20 @@ void action_perform(action_t *action, block_t *block, config_t *config) } } } + warned = false; break; } case ACTION_SET_PAIR: { assert(target != NULL); - - if (target->scheme->change_fn == NULL) { + if (!warned && target->scheme->change_fn == NULL) { log_warn("Block '%s' does not support changing values", target->label); + warned = true; continue; } // Skip "set-" - block_change(target, key + 4, value); + target->scheme->change_fn(target, config, key + 4, value); break; } -- cgit v1.2.3