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/tests/utests/data/test_diff.c b/tests/utests/data/test_diff.c
index bc9e68b..c1a1cf2 100644
--- a/tests/utests/data/test_diff.c
+++ b/tests/utests/data/test_diff.c
@@ -263,7 +263,7 @@
     assert_non_null(st->first);
     st->second = NULL;
 
-    assert_int_equal(lyd_diff_siblings(st->first, lyd_node_children(st->first, 0), 0, &st->diff1), LY_EINVAL);
+    assert_int_equal(lyd_diff_siblings(st->first, lyd_child(st->first), 0, &st->diff1), LY_EINVAL);
 
     assert_int_equal(lyd_diff_siblings(NULL, NULL, 0, NULL), LY_EINVAL);
 }
@@ -375,7 +375,7 @@
     assert_int_equal(lyd_diff_siblings(NULL, NULL, 0, &st->diff1), LY_SUCCESS);
     assert_null(st->diff1);
 
-    assert_int_equal(lyd_diff_siblings(NULL, lyd_node_children(st->first, 0), 0, &st->diff1), LY_SUCCESS);
+    assert_int_equal(lyd_diff_siblings(NULL, lyd_child(st->first), 0, &st->diff1), LY_SUCCESS);
 
     assert_non_null(st->diff1);
     lyd_print_mem(&st->xml, st->diff1, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK);
@@ -386,7 +386,7 @@
     );
 
     free(st->xml);
-    assert_int_equal(lyd_diff_siblings(lyd_node_children(st->first, 0), NULL, 0, &st->diff2), LY_SUCCESS);
+    assert_int_equal(lyd_diff_siblings(lyd_child(st->first), NULL, 0, &st->diff2), LY_SUCCESS);
 
     assert_non_null(st->diff2);
     lyd_print_mem(&st->xml, st->diff2, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK);
diff --git a/tests/utests/data/test_lyb.c b/tests/utests/data/test_lyb.c
index ebb69cb..588ad22 100644
--- a/tests/utests/data/test_lyb.c
+++ b/tests/utests/data/test_lyb.c
@@ -45,7 +45,7 @@
         /* LYD_TREE_DFS_END */
 
         /* select element for the next run - children first */
-        *next = lyd_node_children(*elem, 0);
+        *next = lyd_child(*elem);
         if (!*next) {
             /* no children */
             if (*elem == *start) {
diff --git a/tests/utests/data/test_merge.c b/tests/utests/data/test_merge.c
index 5d3050c..1206994 100644
--- a/tests/utests/data/test_merge.c
+++ b/tests/utests/data/test_merge.c
@@ -574,8 +574,8 @@
     st->source = NULL;
 
     /* c should be replaced and now be default */
-    assert_string_equal(lyd_node_children(st->target, 0)->prev->schema->name, "c");
-    assert_true(lyd_node_children(st->target, 0)->prev->flags & LYD_DEFAULT);
+    assert_string_equal(lyd_child(st->target)->prev->schema->name, "c");
+    assert_true(lyd_child(st->target)->prev->flags & LYD_DEFAULT);
 }
 
 static void
@@ -612,7 +612,7 @@
     assert_int_equal(lyd_merge_siblings(&st->target, st->source, 0), LY_SUCCESS);
 
     /* c should not be replaced, so c remains not default */
-    assert_false(lyd_node_children(st->target, 0)->flags & LYD_DEFAULT);
+    assert_false(lyd_child(st->target)->flags & LYD_DEFAULT);
 }
 
 static void
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index 9b79a7b..34101be 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -647,15 +647,15 @@
     /* TODO support generic attributes in JSON ?
     assert_non_null(((struct lyd_node_opaq *)tree)->attr);
     */
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_string_equal(node->schema->name, "edit-config");
-    node = lyd_node_children(node, 0)->next;
+    node = lyd_child(node)->next;
     assert_string_equal(node->schema->name, "config");
 
     node = ((struct lyd_node_any *)node)->value.tree;
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "cp");
-    node = lyd_node_children(node, 0);
+    node = lyd_child(node);
     /* z has no value */
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "z");
@@ -703,7 +703,7 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "rpc");
     assert_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "action");
     assert_null(((struct lyd_node_opaq *)node)->attr);
@@ -747,7 +747,7 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "notification");
     assert_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "eventTime");
     assert_string_equal(((struct lyd_node_opaq *)node)->value, "2037-07-08T00:01:00Z");
@@ -813,7 +813,7 @@
 
     assert_non_null(op);
     assert_string_equal(op->schema->name, "act");
-    node = lyd_node_children(op, 0);
+    node = lyd_child(op);
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "al");
     assert_true(node->schema->flags & LYS_CONFIG_R);
@@ -821,15 +821,15 @@
     assert_non_null(tree);
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "rpc-reply");
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "c");
 
     /* TODO print only rpc-reply node and then output subtree */
-    lyd_print_tree(out, lyd_node_children(op, 0), LYD_JSON, LYD_PRINT_SHRINK);
+    lyd_print_tree(out, lyd_child(op), LYD_JSON, LYD_PRINT_SHRINK);
     assert_string_equal(str, "{\"a:al\":25}");
     ly_out_reset(out);
-    lyd_print_tree(out, lyd_node_children(tree, 0), LYD_JSON, LYD_PRINT_SHRINK);
+    lyd_print_tree(out, lyd_child(tree), LYD_JSON, LYD_PRINT_SHRINK);
     assert_string_equal(str, "{\"a:c\":{\"act\":{\"al\":25}}}");
     ly_out_reset(out);
     lyd_free_all(tree);
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index a263ef2..c98bc95 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -437,15 +437,15 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "rpc");
     assert_non_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_string_equal(node->schema->name, "edit-config");
-    node = lyd_node_children(node, 0)->next;
+    node = lyd_child(node)->next;
     assert_string_equal(node->schema->name, "config");
 
     node = ((struct lyd_node_any *)node)->value.tree;
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "cp");
-    node = lyd_node_children(node, 0);
+    node = lyd_child(node);
     /* z has no value */
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "z");
@@ -519,7 +519,7 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "rpc");
     assert_non_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "action");
     assert_null(((struct lyd_node_opaq *)node)->attr);
@@ -580,7 +580,7 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "notification");
     assert_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_null(node->schema);
     assert_string_equal(((struct lyd_node_opaq *)node)->name, "eventTime");
     assert_string_equal(((struct lyd_node_opaq *)node)->value, "2037-07-08T00:01:00Z");
@@ -654,7 +654,7 @@
 
     assert_non_null(op);
     assert_string_equal(op->schema->name, "act");
-    node = lyd_node_children(op, 0);
+    node = lyd_child(op);
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "al");
     assert_true(node->schema->flags & LYS_CONFIG_R);
@@ -663,12 +663,12 @@
     assert_null(tree->schema);
     assert_string_equal(((struct lyd_node_opaq *)tree)->name, "rpc-reply");
     assert_non_null(((struct lyd_node_opaq *)tree)->attr);
-    node = lyd_node_children(tree, 0);
+    node = lyd_child(tree);
     assert_non_null(node->schema);
     assert_string_equal(node->schema->name, "c");
 
     /* TODO print only rpc-reply node and then output subtree */
-    lyd_print_tree(out, lyd_node_children(op, 0), LYD_XML, LYD_PRINT_SHRINK);
+    lyd_print_tree(out, lyd_child(op), LYD_XML, LYD_PRINT_SHRINK);
     assert_string_equal(str,
         "<al xmlns=\"urn:tests:a\">25</al>");
     ly_out_reset(out);
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index ff4d20e..ba2cd84 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -1016,7 +1016,7 @@
     TEST_DATA("<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
               "<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>y</lr1></l></c>", LY_SUCCESS, "");
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
-    leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->next, 0)->prev);
+    leaf = (struct lyd_node_term*)(lyd_child(lyd_child(tree)->next)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr1", leaf->schema->name);
     assert_string_equal("y", leaf->value.canonical);
@@ -1026,7 +1026,7 @@
               "<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
               "<l><id>x</id><value>x</value><lr2>y</lr2></l></c>", LY_SUCCESS, "");
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
-    leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->prev, 0)->prev);
+    leaf = (struct lyd_node_term*)(lyd_child(lyd_child(tree)->prev)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr2", leaf->schema->name);
     assert_string_equal("y", leaf->value.canonical);
@@ -1037,7 +1037,7 @@
               "<c xmlns=\"urn:tests:leafrefs\"><x><x>y</x></x>"
               "<l><id>x</id><value>x</value><lr3>c</lr3></l></c>", LY_SUCCESS, "");
     assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
-    leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->prev, 0)->prev);
+    leaf = (struct lyd_node_term*)(lyd_child(lyd_child(tree)->prev)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr3", leaf->schema->name);
     assert_string_equal("c", leaf->value.canonical);
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index d4f2b47..5b6953d 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -492,8 +492,8 @@
     data = "<cont xmlns=\"urn:tests:a\"><a>val</a><b>val_b</b></cont><c xmlns=\"urn:tests:a\">val_c</c>";
     assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(ctx, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
     assert_non_null(tree);
-    assert_string_equal("a", lyd_node_children(tree, 0)->schema->name);
-    assert_int_equal(LYD_WHEN_TRUE, lyd_node_children(tree, 0)->flags);
+    assert_string_equal("a", lyd_child(tree)->schema->name);
+    assert_int_equal(LYD_WHEN_TRUE, lyd_child(tree)->flags);
     assert_string_equal("c", tree->next->schema->name);
     assert_int_equal(LYD_WHEN_TRUE, tree->next->flags);
     lyd_free_all(tree);