data types CHANGE validate instance-identifier values
Quite a big patch dut to the problems with instance-identifiers:
- different format in XML and JSON
- prefixes must be resolved correctly even in predicates to be able to
compare values in predicates with other values (even another
instance-identifier, prefixed identityrefs or, in contrast, strings
where 'something:' is not a prefix).
diff --git a/src/tree_data_free.c b/src/tree_data_free.c
index f594872..6e28fdb 100644
--- a/src/tree_data_free.c
+++ b/src/tree_data_free.c
@@ -25,6 +25,27 @@
#include "tree_data_internal.h"
#include "plugins_types.h"
+void
+lyd_value_free_path(struct ly_ctx *ctx, struct lyd_value_path *path)
+{
+ unsigned int u, v;
+
+ LY_ARRAY_FOR(path, u) {
+ LY_ARRAY_FOR(path[u].predicates, v) {
+ if (path[u].predicates[v].type > 0) {
+ struct lysc_type *t = ((struct lysc_node_leaf*)path[u].predicates[v].key)->type;
+ if (t->plugin->free) {
+ t->plugin->free(ctx, t, path[u].predicates[v].value);
+ }
+ lydict_remove(ctx, path[u].predicates[v].value->canonized);
+ free(path[u].predicates[v].value);
+ }
+ }
+ LY_ARRAY_FREE(path[u].predicates);
+ }
+ LY_ARRAY_FREE(path);
+}
+
API LY_ERR
lyd_unlink_tree(struct lyd_node *node)
{