schema helpers CHANGE added LYS_MOD_IMPORTED_REV
The new ::lys_get_module_without_revision() modifies the behavior of
the ::lys_parse_load() when a module is imported without specifying a
revision. Such an imported module is marked with the
::LYS_MOD_IMPORTED_REV flag and its priority is the highest. Also, the
implemented module takes precedence over the module with the latest
revision.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 2a399cd..66c42a4 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1191,6 +1191,14 @@
imp = &pmod->imports[u];
if (!imp->module) {
LY_CHECK_RET(lys_parse_load(PARSER_CTX(pctx), imp->name, imp->rev[0] ? imp->rev : NULL, new_mods, &imp->module));
+
+ if (!imp->rev[0]) {
+ /* This module must be selected for the next similar
+ * import without revision-date to avoid incorrect
+ * derived identities in the ::lys_module.identities.
+ */
+ imp->module->latest_revision |= LYS_MOD_IMPORTED_REV;
+ }
}
/* check for importing the same module twice */
for (v = 0; v < u; ++v) {