data tree CHANGE move macros to functions to cleanup API
Remove lyd_node_children() since it is just an old duplication of
LYD_CHILD and LYD_CHILD_NO_KEYS macros. As a consequence, these macros
are converted to the functions together with LYD_PARENT (same names, but
lowercase) since they have similar functionality in the API.
diff --git a/src/tree_data.c b/src/tree_data.c
index e68314d..4da6eb2 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1777,7 +1777,7 @@
{
struct lyd_node_inner *par;
- assert(parent && !lyd_node_children(parent, 0) && !node->next && (node->prev == node));
+ assert(parent && !lyd_child(parent) && !node->next && (node->prev == node));
assert(!parent->schema || (parent->schema->nodetype & LYD_NODE_INNER));
par = (struct lyd_node_inner *)parent;
@@ -1811,7 +1811,7 @@
const struct lysc_node *skey = NULL;
assert(list->schema->nodetype == LYS_LIST);
- key = lyd_node_children(list, 0);
+ key = lyd_child(list);
while ((skey = lys_getnext(skey, list->schema, NULL, 0)) && (skey->flags & LYS_KEY)) {
if (!key || (key->schema != skey)) {
/* key missing */
@@ -2815,7 +2815,7 @@
match_trg->flags = sibling_src->flags | LYD_NEW;
} else {
/* check descendants, recursively */
- LY_LIST_FOR_SAFE(LYD_CHILD_NO_KEYS(sibling_src), tmp, child_src) {
+ LY_LIST_FOR_SAFE(lyd_child_no_keys(sibling_src), tmp, child_src) {
LY_CHECK_RET(lyd_merge_sibling_r(lyd_node_children_p(match_trg), match_trg, &child_src, options));
}
}
@@ -2923,7 +2923,7 @@
const char *val;
char quot;
- for (key = lyd_node_children(node, 0); key && (key->schema->flags & LYS_KEY); key = key->next) {
+ for (key = lyd_child(node); key && (key->schema->flags & LYS_KEY); key = key->next) {
val = LYD_CANON_VALUE(key);
len = 1 + strlen(key->schema->name) + 2 + strlen(val) + 2;
LY_CHECK_RET(lyd_path_str_enlarge(buffer, buflen, *bufused + len, is_static));