diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f77e025..2a76fabb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Expected: April Developers may need to change their code +* Removed `yspec_free()` - replace with `ys_free()` * Removed `endtag` parameter of `clixon_xml_parse_file()` * Restconf authentication callback (ca_auth) signature changed (again) * Minor modification to 5.0 change: userp removed. diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index 7b81e252..96a12b46 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -113,11 +113,11 @@ backend_terminate(clicon_handle h) if ((x = clicon_xml_changelog_get(h)) != NULL) xml_free(x); if ((yspec = clicon_dbspec_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((yspec = clicon_config_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((yspec = clicon_nacm_ext_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((nsctx = clicon_nsctx_global_get(h)) != NULL) cvec_free(nsctx); if ((x = clicon_nacm_ext(h)) != NULL) diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 8e153502..f347cca1 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -169,9 +169,9 @@ cli_terminate(clicon_handle h) clicon_rpc_close_session(h); if ((yspec = clicon_dbspec_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((yspec = clicon_config_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((nsctx = clicon_nsctx_global_get(h)) != NULL) cvec_free(nsctx); if ((x = clicon_conf_xml(h)) != NULL) diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index cf692481..fca359df 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -588,9 +588,9 @@ netconf_terminate(clicon_handle h) rpc_callback_delete_all(h); clicon_rpc_close_session(h); if ((yspec = clicon_dbspec_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((yspec = clicon_config_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((nsctx = clicon_nsctx_global_get(h)) != NULL) cvec_free(nsctx); if ((x = clicon_conf_xml(h)) != NULL) diff --git a/apps/restconf/restconf_lib.c b/apps/restconf/restconf_lib.c index feca2264..c1d2e835 100644 --- a/apps/restconf/restconf_lib.c +++ b/apps/restconf/restconf_lib.c @@ -246,9 +246,9 @@ restconf_terminate(clicon_handle h) rpc_callback_delete_all(h); clicon_rpc_close_session(h); if ((yspec = clicon_dbspec_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((yspec = clicon_config_yang(h)) != NULL) - yspec_free(yspec); + ys_free(yspec); if ((nsctx = clicon_nsctx_global_get(h)) != NULL) cvec_free(nsctx); if ((x = clicon_conf_xml(h)) != NULL) diff --git a/lib/clixon/clixon_yang.h b/lib/clixon/clixon_yang.h index fa4bef0b..956ef74e 100644 --- a/lib/clixon/clixon_yang.h +++ b/lib/clixon/clixon_yang.h @@ -212,7 +212,6 @@ yang_stmt *ys_new(enum rfc_6020 keyw); yang_stmt *ys_prune(yang_stmt *yp, int i); int ys_free(yang_stmt *ys); -int yspec_free(yang_stmt *yspec); int ys_cp(yang_stmt *nw, yang_stmt *old); yang_stmt *ys_dup(yang_stmt *old); int yn_insert(yang_stmt *ys_parent, yang_stmt *ys_child); diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 46346e6b..7ff8e867 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -401,7 +401,7 @@ yang_when_nsc_set(yang_stmt *ys, /* End access functions */ /*! Create new yang specification - * @retval yspec Free with yspec_free() + * @retval yspec Free with ys_free() * @retval NULL Error */ yang_stmt * @@ -532,24 +532,6 @@ ys_free(yang_stmt *ys) return 0; } -/*! Free a yang specification recursively - */ -int -yspec_free(yang_stmt *yspec) -{ - int i; - yang_stmt *ys; - - for (i=0; iys_len; i++){ - if ((ys = yspec->ys_stmt[i]) != NULL) - ys_free(ys); - } - if (yspec->ys_stmt) - free(yspec->ys_stmt); - free(yspec); - return 0; -} - /*! Allocate larger yang statement vector adding empty field last */ static int yn_realloc(yang_stmt *yn) diff --git a/util/clixon_util_datastore.c b/util/clixon_util_datastore.c index 7d792031..65e611f2 100644 --- a/util/clixon_util_datastore.c +++ b/util/clixon_util_datastore.c @@ -345,7 +345,7 @@ main(int argc, char **argv) if (h) clicon_handle_exit(h); if (yspec) - yspec_free(yspec); + ys_free(yspec); return retval; } diff --git a/util/clixon_util_json.c b/util/clixon_util_json.c index 4d31d7b7..389b27ca 100644 --- a/util/clixon_util_json.c +++ b/util/clixon_util_json.c @@ -155,7 +155,7 @@ main(int argc, retval = 0; done: if (yspec) - yspec_free(yspec); + ys_free(yspec); if (xt) xml_free(xt); if (cb) diff --git a/util/clixon_util_path.c b/util/clixon_util_path.c index d07f6bdb..f75a36da 100644 --- a/util/clixon_util_path.c +++ b/util/clixon_util_path.c @@ -286,7 +286,7 @@ main(int argc, retval = 0; done: if (yspec != NULL) - yspec_free(yspec); + ys_free(yspec); if (cb) cbuf_free(cb); if (xvec) diff --git a/util/clixon_util_xml_mod.c b/util/clixon_util_xml_mod.c index 074d6e4d..7347842c 100644 --- a/util/clixon_util_xml_mod.c +++ b/util/clixon_util_xml_mod.c @@ -298,7 +298,7 @@ main(int argc, char **argv) if (reason) free(reason); if (yspec) - yspec_free(yspec); + ys_free(yspec); if (fd > 0) close(fd); return retval; diff --git a/util/clixon_util_yang.c b/util/clixon_util_yang.c index 0236898c..7f7ea051 100644 --- a/util/clixon_util_yang.c +++ b/util/clixon_util_yang.c @@ -114,7 +114,7 @@ main(int argc, char **argv) yang_print(stdout, yspec); done: if (yspec) - yspec_free(yspec); + ys_free(yspec); return 0; }