yanglint FEATURE initial version of yanglint(1)
Source codes are mostly taken from libyang 1.0 and slightly modified for
libyang 2.0. A lot of functionality is still missing since it is not yet
provided by libyang 2.0
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 7d18109..1ff0161 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -747,8 +747,18 @@
if (!*mod) {
/* try to get the module from the context */
if (revision) {
+ /* get the specific revision */
*mod = (struct lys_module*)ly_ctx_get_module(ctx, name, revision);
+ } else if (implement) {
+ /* prefer the implemented module instead of the latest one */
+ *mod = (struct lys_module*)ly_ctx_get_module_implemented(ctx, name);
+ if (!*mod) {
+ /* there is no implemented module in the context, try to get the latest revision module */
+ goto latest_in_the_context;
+ }
} else {
+ /* get the requested module of the latest revision in the context */
+latest_in_the_context:
*mod = (struct lys_module*)ly_ctx_get_module_latest(ctx, name);
}
}