Skip to content

Commit 1175ce4

Browse files
committed
log BUGFIX handle top-level uses when printing node path
Fixes #813
1 parent adcb9da commit 1175ce4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/log.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,12 @@ ly_vlog_build_path(enum LY_VLOG_ELEM elem_type, const void *elem, char **path, i
611611
top_smodule = lys_node_module(sparent);
612612
}
613613

614-
if (!((struct lys_node *)elem)->parent || (lys_node_module((struct lys_node *)elem) != top_smodule)
615-
|| schema_all_prefixes) {
614+
/* skip uses */
615+
sparent = lys_parent((struct lys_node *)elem);
616+
while (sparent && (sparent->nodetype == LYS_USES)) {
617+
sparent = lys_parent(sparent);
618+
}
619+
if (!sparent || (lys_node_module((struct lys_node *)elem) != top_smodule) || schema_all_prefixes) {
616620
prefix = lys_node_module((struct lys_node *)elem)->name;
617621
} else {
618622
prefix = NULL;

0 commit comments

Comments
 (0)