forked from external/yambar
config-verify: add conf_verify_list()
This commit is contained in:
parent
205801625f
commit
b0e9c02876
2 changed files with 22 additions and 0 deletions
|
@ -50,6 +50,26 @@ conf_verify_int(keychain_t *chain, const struct yml_node *node)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
conf_verify_list(keychain_t *chain, const struct yml_node *node,
|
||||
bool (*verify)(keychain_t *chain, const struct yml_node *node))
|
||||
{
|
||||
if (!yml_is_list(node)) {
|
||||
LOG_ERR("%s: value is not a list", conf_err_prefix(chain, node));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (struct yml_list_iter iter = yml_list_iter(node);
|
||||
iter.node != NULL;
|
||||
yml_list_next(&iter))
|
||||
{
|
||||
if (!verify(chain, iter.node))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
conf_verify_enum(keychain_t *chain, const struct yml_node *node,
|
||||
const char *values[], size_t count)
|
||||
|
|
|
@ -35,6 +35,8 @@ bool conf_verify_int(keychain_t *chain, const struct yml_node *node);
|
|||
|
||||
bool conf_verify_enum(keychain_t *chain, const struct yml_node *node,
|
||||
const char *values[], size_t count);
|
||||
bool conf_verify_list(keychain_t *chain, const struct yml_node *node,
|
||||
bool (*verify)(keychain_t *chain, const struct yml_node *node));
|
||||
bool conf_verify_dict(keychain_t *chain, const struct yml_node *node,
|
||||
const struct attr_info info[]); /* NULL-terminated list */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue