aboutsummaryrefslogtreecommitdiff
path: root/src/blocks/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/blocks/ram.c')
-rw-r--r--src/blocks/ram.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/blocks/ram.c b/src/blocks/ram.c
index 4841860..8790ee3 100644
--- a/src/blocks/ram.c
+++ b/src/blocks/ram.c
@@ -124,33 +124,33 @@ static void block_ram_clean(block_t *block)
free(ram->block.text);
}
-static bool block_ram_validate(block_t *block, const block_scheme_t *scheme)
+static int block_ram_validate(block_t *block, const block_scheme_t *scheme)
{
block_ram_t *ram = (block_ram_t *)block;
+ int errors = 0;
if (ram->block.text == NULL) {
log_error("Block '%s' requires key '%s'", block->label, "text");
- return false;
+ errors++;
}
if (!format_init(&ram->format, ram->block.text, '%')) {
log_error("Block '%s' has an invalid format", block->label);
- return false;
- }
-
- int marked = format_remark(&ram->format, block->label, block_ram_options);
- if (marked < 0)
- return false;
+ errors++;
+ } else {
+ int marked = format_remark(&ram->format, block->label, block_ram_options);
+ if (marked < 0)
+ errors += -marked;
- if (marked == 0) {
- log_warn("Block '%s' does not use any ram option", block->label);
+ if (marked == 0) {
+ log_warn("Block '%s' does not use any ram option", block->label);
- block->update_fn = NULL;
- log_debug("Disabled updates for block '%s'", block->label);
- return true;
+ block->update_fn = NULL;
+ log_debug("Disabled updates for block '%s'", block->label);
+ }
}
- return true;
+ return errors;
}
const block_scheme_t block_ram_scheme = {
@@ -159,5 +159,4 @@ const block_scheme_t block_ram_scheme = {
.alloc_fn = block_ram_alloc,
.clean_fn = block_ram_clean,
.validate_fn = block_ram_validate,
- .resolve_fn = NULL,
};