schema CHANGE remove private_destructor parameter from ly_ctx_destroy()
The mechanism was not reliable and not used often. libyang provide
function to traverse the schema and free the set data manually or the
caller can maintain some information to free the set data directly.
This commit changes API.
diff --git a/src/context.c b/src/context.c
index de6e4c3..7c9a93c 100644
--- a/src/context.c
+++ b/src/context.c
@@ -287,7 +287,7 @@
error:
ly_in_free(in, 0);
lys_compile_unres_glob_erase(ctx, &unres);
- ly_ctx_destroy(ctx, NULL);
+ ly_ctx_destroy(ctx);
return rc;
}
@@ -438,11 +438,11 @@
ly_set_free(set, NULL);
ly_set_erase(&features, NULL);
if (ctx_yl != ctx_new) {
- ly_ctx_destroy(ctx_yl, NULL);
+ ly_ctx_destroy(ctx_yl);
}
*ctx = ctx_new;
if (ret) {
- ly_ctx_destroy(*ctx, NULL);
+ ly_ctx_destroy(*ctx);
*ctx = NULL;
}
@@ -1098,7 +1098,7 @@
}
API void
-ly_ctx_destroy(struct ly_ctx *ctx, void (*private_destructor)(const struct lysc_node *node, void *priv))
+ly_ctx_destroy(struct ly_ctx *ctx)
{
if (!ctx) {
return;
@@ -1107,7 +1107,7 @@
/* models list */
for ( ; ctx->list.count; ctx->list.count--) {
/* remove the module */
- lys_module_free(ctx->list.objs[ctx->list.count - 1], private_destructor);
+ lys_module_free(ctx->list.objs[ctx->list.count - 1]);
}
free(ctx->list.objs);