schema CHANGE remove lysc_node_parent_full()
The function is no more neededed after unifying all the schema node
structures available as parents.
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index 7a24c76..42ca4e7 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -1423,16 +1423,10 @@
lysp_schema_nodeid_match_node(const struct lysc_node **node, const struct lys_module *mod, const char *name,
size_t name_len)
{
- const struct lys_module *node_mod;
const char *node_name;
/* compare with the module of the node */
- if ((*node)->nodetype & (LYS_INPUT | LYS_OUTPUT)) {
- node_mod = lysc_node_parent_full(*node)->module;
- } else {
- node_mod = (*node)->module;
- }
- if (node_mod != mod) {
+ if ((*node)->module != mod) {
return 0;
}
@@ -1449,7 +1443,7 @@
}
/* move to next parent */
- *node = lysc_node_parent_full(*node);
+ *node = (*node)->parent;
return 1;
}
diff --git a/src/tree_schema.h b/src/tree_schema.h
index eb0f609..8c72eba 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -108,7 +108,6 @@
* - ::lysc_has_when()
*
* - ::lysc_node_children()
- * - ::lysc_node_parent_full()
* - ::lysc_node_actions()
* - ::lysc_node_notifs()
*
@@ -213,7 +212,7 @@
} \
while (!(LYSC_TREE_DFS_next)) { \
/* parent is already processed, go to its sibling */ \
- (ELEM) = (struct lysc_node *)lysc_node_parent_full(ELEM); \
+ (ELEM) = (ELEM)->parent; \
_LYSC_TREE_DFS_NEXT(START, ELEM, LYSC_TREE_DFS_next); \
} }
@@ -227,7 +226,7 @@
} \
if ((ELEM)->nodetype == LYS_INPUT) { \
/* after input, get output */ \
- (NEXT) = (struct lysc_node *)lysc_node_children(lysc_node_parent_full(ELEM), LYS_CONFIG_R); \
+ (NEXT) = (struct lysc_node *)lysc_node_children((ELEM)->parent, LYS_CONFIG_R); \
} else if ((ELEM)->nodetype == LYS_OUTPUT) { \
/* no sibling of output */ \
(NEXT) = NULL; \
@@ -1968,17 +1967,6 @@
const struct lysc_node *lysc_node_children(const struct lysc_node *node, uint16_t flags);
/**
- * @brief Get the parent pointer from any type of (compiled) schema node.
- * Returns input or output for direct descendants of RPC/action nodes.
- * To skip them, use ::lysc_node.parent pointer directly.
- *
- * @param[in] node Node whose parent to get.
- * @return Node parent.
- * @return NULL is there is none.
- */
-const struct lysc_node *lysc_node_parent_full(const struct lysc_node *node);
-
-/**
* @brief Callback to be called for every schema node in a DFS traversal.
*
* @param[in] node Current node.
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 592bccb..54d80b1 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1397,26 +1397,6 @@
}
}
-API const struct lysc_node *
-lysc_node_parent_full(const struct lysc_node *node)
-{
- if (!node) {
- return NULL;
- } else if (node->nodetype == LYS_INPUT) {
- return (struct lysc_node *)(((char *)node) - offsetof(struct lysc_node_action, input));
- } else if (node->nodetype == LYS_OUTPUT) {
- return (struct lysc_node *)(((char *)node) - offsetof(struct lysc_node_action, output));
- } else if (node->parent && (node->parent->nodetype & (LYS_RPC | LYS_ACTION))) {
- if (node->flags & LYS_CONFIG_W) {
- return (struct lysc_node *)&((struct lysc_node_action *)node->parent)->input;
- } else {
- return (struct lysc_node *)&((struct lysc_node_action *)node->parent)->output;
- }
- } else {
- return node->parent;
- }
-}
-
struct lys_module *
lysp_find_module(struct ly_ctx *ctx, const struct lysp_module *mod)
{
@@ -1673,7 +1653,7 @@
parent = schema;
while (parent && !(parent->nodetype & (LYS_CONTAINER | LYS_LEAF | LYS_LEAFLIST | LYS_LIST | LYS_ANYDATA | LYS_RPC |
LYS_ACTION | LYS_NOTIF))) {
- parent = lysc_node_parent_full(parent);
+ parent = parent->parent;
}
return parent;
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 558c010..afeefac 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -676,7 +676,7 @@
/**
* @brief Same as ::lysc_data_node() but never returns the node itself.
*/
-#define lysc_data_parent(schema) lysc_data_node(lysc_node_parent_full(schema))
+#define lysc_data_parent(SCHEMA) lysc_data_node((SCHEMA)->parent)
/**
* @brief Learn whether a node is inside an operation output.