schema tree FEATURE every schema node has a priv pointer
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index bedf795..fc32f53 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1730,3 +1730,47 @@
return 1;
}
+
+API LY_ERR
+lysc_set_private(const struct lysc_node *node, void *priv, void **prev)
+{
+ struct lysc_action *act;
+ struct lysc_notif *notif;
+
+ LY_CHECK_ARG_RET(NULL, node, LY_EINVAL);
+
+ switch (node->nodetype) {
+ case LYS_CONTAINER:
+ case LYS_CHOICE:
+ case LYS_CASE:
+ case LYS_LEAF:
+ case LYS_LEAFLIST:
+ case LYS_LIST:
+ case LYS_ANYXML:
+ case LYS_ANYDATA:
+ if (prev) {
+ *prev = node->priv;
+ }
+ ((struct lysc_node *)node)->priv = priv;
+ break;
+ case LYS_RPC:
+ case LYS_ACTION:
+ act = (struct lysc_action *)node;
+ if (prev) {
+ *prev = act->priv;
+ }
+ act->priv = priv;
+ break;
+ case LYS_NOTIF:
+ notif = (struct lysc_notif *)node;
+ if (prev) {
+ *prev = notif->priv;
+ }
+ notif->priv = priv;
+ break;
+ default:
+ return LY_EINVAL;
+ }
+
+ return LY_SUCCESS;
+}