context UPDATE remove deprecated explicit latests flag removal
diff --git a/src/context.c b/src/context.c
index 9d379c6..a7902e9 100644
--- a/src/context.c
+++ b/src/context.c
@@ -115,8 +115,17 @@
return LY_EMEM;
}
- /* new searchdir - possibly more latest revision available */
- ly_ctx_reset_latests(ctx);
+ /* new searchdir - reset latests flags (possibly new revisions available) */
+ for (uint32_t v = 0; v < ctx->list.count; ++v) {
+ struct lys_module *mod = ctx->list.objs[v];
+
+ mod->latest_revision &= ~LYS_MOD_LATEST_SEARCHDIRS;
+ if (mod->parsed && mod->parsed->includes) {
+ for (LY_ARRAY_COUNT_TYPE u = 0; u < LY_ARRAY_COUNT(mod->parsed->includes); ++u) {
+ mod->parsed->includes[u].submodule->latest_revision &= ~LYS_MOD_LATEST_SEARCHDIRS;
+ }
+ }
+ }
return LY_SUCCESS;
} else {
@@ -759,6 +768,18 @@
ctx->imp_clb = clb;
ctx->imp_clb_data = user_data;
+
+ /* new import callback - reset latests flags (possibly new revisions available) */
+ for (uint32_t v = 0; v < ctx->list.count; ++v) {
+ struct lys_module *mod = ctx->list.objs[v];
+
+ mod->latest_revision &= ~LYS_MOD_LATEST_IMPCLB;
+ if (mod->parsed && mod->parsed->includes) {
+ for (LY_ARRAY_COUNT_TYPE u = 0; u < LY_ARRAY_COUNT(mod->parsed->includes); ++u) {
+ mod->parsed->includes[u].submodule->latest_revision &= ~LYS_MOD_LATEST_IMPCLB;
+ }
+ }
+ }
}
LIBYANG_API_DEF ly_ext_data_clb
@@ -1039,22 +1060,6 @@
return _ly_ctx_get_submodule2(module, submodule, NULL, 1);
}
-LIBYANG_API_DEF void
-ly_ctx_reset_latests(struct ly_ctx *ctx)
-{
- struct lys_module *mod;
-
- for (uint32_t v = 0; v < ctx->list.count; ++v) {
- mod = ctx->list.objs[v];
- mod->latest_revision &= ~(LYS_MOD_LATEST_SEARCHDIRS | LYS_MOD_LATEST_IMPCLB);
- if (mod->parsed && mod->parsed->includes) {
- for (LY_ARRAY_COUNT_TYPE u = 0; u < LY_ARRAY_COUNT(mod->parsed->includes); ++u) {
- mod->parsed->includes[u].submodule->latest_revision &= ~(LYS_MOD_LATEST_SEARCHDIRS | LYS_MOD_LATEST_IMPCLB);
- }
- }
- }
-}
-
LIBYANG_API_DEF uint32_t
ly_ctx_internal_modules_count(const struct ly_ctx *ctx)
{
diff --git a/src/context.h b/src/context.h
index 318c614..8e8b205 100644
--- a/src/context.h
+++ b/src/context.h
@@ -122,7 +122,6 @@
* - ::ly_ctx_get_submodule_latest()
* - ::ly_ctx_get_submodule2()
* - ::ly_ctx_get_submodule2_latest()
- * - ::ly_ctx_reset_latests()
*
* - ::ly_ctx_get_yanglib_data()
*
@@ -589,25 +588,6 @@
const char *submodule);
/**
- * @brief Reset cached latest revision information of the schemas in the context.
- *
- * This function is deprecated and should not be used.
- *
- * When a (sub)module is imported/included without revision, the latest revision is
- * searched. libyang searches for the latest revision in searchdirs and/or via provided
- * import callback ::ly_module_imp_clb() just once. Then it is expected that the content
- * of searchdirs or data returned by the callback does not change. So when it changes,
- * it is necessary to force searching for the latest revision in case of loading another
- * module, which what this function does.
- *
- * The latest revision information is also reset when the searchdirs set changes via
- * ::ly_ctx_set_searchdir().
- *
- * @param[in] ctx libyang context where the latest revision information is going to be reset.
- */
-LIBYANG_API_DECL void ly_ctx_reset_latests(struct ly_ctx *ctx);
-
-/**
* @brief Learn the number of internal modules of a context. Internal modules
* is considered one that was loaded during the context creation.
*