Skip to content

Commit 8bdcf26

Browse files
author
IrfanMohammad
committed
Make tree_data static functions available in api
We need certain functions to be exposed via a public API to make it possible to use in other languages such as Rust. lyd_parent, lyd_child, and lyd_get_value are defined as static inline and is difficult for tools to wrap them.
1 parent 0119b92 commit 8bdcf26

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/tree_data.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,3 +3056,21 @@ lyd_find_target(const struct ly_path *path, const struct lyd_node *tree, struct
30563056
}
30573057
return LY_SUCCESS;
30583058
}
3059+
3060+
LIBYANG_API_DEF struct lyd_node *
3061+
lyd_get_parent(const struct lyd_node *node)
3062+
{
3063+
return lyd_parent(node);
3064+
}
3065+
3066+
LIBYANG_API_DEF struct lyd_node *
3067+
lyd_get_child(const struct lyd_node *node)
3068+
{
3069+
return lyd_child(node);
3070+
}
3071+
3072+
LIBYANG_API_DEF const char *
3073+
lyd_node_get_value(const struct lyd_node *node)
3074+
{
3075+
return lyd_get_value(node);
3076+
}

src/tree_data.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ lyd_parent(const struct lyd_node *node)
10141014
return &node->parent->node;
10151015
}
10161016

1017+
LIBYANG_API_DECL struct lyd_node *
1018+
lyd_get_parent(const struct lyd_node *node);
1019+
10171020
/**
10181021
* @brief Get the child pointer of a generic data node.
10191022
*
@@ -1048,6 +1051,9 @@ lyd_child(const struct lyd_node *node)
10481051
}
10491052
}
10501053

1054+
LIBYANG_API_DECL struct lyd_node *
1055+
lyd_get_child(const struct lyd_node *node);
1056+
10511057
/**
10521058
* @brief Get the child pointer of a generic data node but skip its keys in case it is ::LYS_LIST.
10531059
*
@@ -1159,6 +1165,9 @@ lyd_get_value(const struct lyd_node *node)
11591165
return NULL;
11601166
}
11611167

1168+
LIBYANG_API_DECL const char *
1169+
lyd_node_get_value(const struct lyd_node *node);
1170+
11621171
/**
11631172
* @brief Get anydata string value.
11641173
*

0 commit comments

Comments
 (0)