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/tree_schema_free.c b/src/tree_schema_free.c
index c125e7f..110da25 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -927,13 +927,16 @@
lysc_node_free_(ctx, node);
}
-static void
-lysc_module_free_(struct lysc_module *module)
+void
+lysc_module_free(struct lysc_module *module)
{
struct ly_ctx *ctx;
struct lysc_node *node, *node_next;
- LY_CHECK_ARG_RET(NULL, module, );
+ if (!module) {
+ return;
+ }
+
ctx = module->mod->ctx;
LY_LIST_FOR_SAFE(module->data, node_next, node) {
@@ -951,28 +954,13 @@
}
void
-lysc_module_free(struct lysc_module *module, void (*private_destructor)(const struct lysc_node *node, void *priv))
-{
- /* TODO use the destructor, this just suppress warning about unused parameter */
- (void) private_destructor;
-
- /* TODO if (module->mod->ctx->flags & LY_CTX_SET_PRIV_PARSED) is true, then
- * don't use the destructor because private pointers are used by libyang.
- */
-
- if (module) {
- lysc_module_free_(module);
- }
-}
-
-void
-lys_module_free(struct lys_module *module, void (*private_destructor)(const struct lysc_node *node, void *priv))
+lys_module_free(struct lys_module *module)
{
if (!module) {
return;
}
- lysc_module_free(module->compiled, private_destructor);
+ lysc_module_free(module->compiled);
FREE_ARRAY(module->ctx, module->identities, lysc_ident_free);
lysp_module_free(module->parsed);