data FEATURE add helpers functions to work with data trees (sized arrays)
Adds lyd_trees_new() and lyd_trees_free() and unifies work with the data
trees in validation functions.
diff --git a/src/parser_xml.c b/src/parser_xml.c
index e94e4f5..75e3c55 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -306,18 +306,16 @@
/* finish incompletely validated terminal values */
for (unsigned int u = 0; u < xmlctx.incomplete_type_validation.count; u++) {
struct lyd_node_term *node = (struct lyd_node_term*)xmlctx.incomplete_type_validation.objs[u];
- struct lyd_node **trees = NULL;
+ const struct lyd_node **trees = NULL;
/* prepare sized array for validator */
if (*result) {
- struct lyd_node **tree;
- LY_ARRAY_NEW_RET(ctx, trees, tree, LY_EMEM);
- *tree = *result;
+ trees = lyd_trees_new(1, *result);
}
/* validate and store the value of the node */
ret = lyd_value_parse(node, node->value.canonized, node->value.canonized ? strlen(node->value.canonized) : 0, 0, 1,
lydxml_resolve_prefix, ctx, LYD_XML, trees);
- LY_ARRAY_FREE(trees);
+ lyd_trees_free(trees, 0);
if (ret) {
lyd_free_all(*result);
*result = NULL;