Align YAML config getlist with libconfig implementation

This aligns the behavior of params_yaml with params_config library so that
when a mapping is read using getlist it returns the number of elements in
the mapping instead of 0.
This commit is contained in:
Bartosz Podrygajlo
2024-12-02 13:32:19 +01:00
parent 03946cd47b
commit b6b377ffc0
4 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -286,10 +286,10 @@ extern "C" int config_yaml_getlist(configmodule_interface_t *cfg,
return -1;
}
ParamList->numelt = node.size();
if (!node.IsSequence()) {
return -1;
}
ParamList->numelt = node.size();
if (ParamList->numelt > 0 && params != NULL) {
ParamList->paramarray = static_cast<paramdef_t **>(config_allocate_new(cfg, ParamList->numelt * sizeof(paramdef_t *), true));