@@ -523,7 +523,7 @@ ly_vlog_build_path(enum LY_VLOG_ELEM elem_type, const void *elem, char **path, i
523523{
524524 int i , j , yang_data_extension = 0 ;
525525 struct lys_node_list * slist ;
526- struct lys_node * sparent = NULL ;
526+ struct lys_node * sparent ;
527527 struct lyd_node * dlist , * diter ;
528528 const struct lys_module * top_smodule = NULL ;
529529 const char * name , * prefix = NULL , * val_end , * val_start , * ext_name ;
@@ -544,12 +544,14 @@ ly_vlog_build_path(enum LY_VLOG_ELEM elem_type, const void *elem, char **path, i
544544 elem = ((struct lyxml_elem * )elem )-> parent ;
545545 break ;
546546 case LY_VLOG_LYS :
547- if (!top_smodule && ! schema_all_prefixes ) {
547+ if (!top_smodule ) {
548548 /* remember the top module, it will act as the current module */
549- top_smodule = lys_node_module ((struct lys_node * )elem );
549+ for (sparent = (struct lys_node * )elem ; lys_parent (sparent ); sparent = lys_parent (sparent ));
550+ top_smodule = lys_node_module (sparent );
550551 }
551552
552- if (!((struct lys_node * )elem )-> parent || lys_node_module ((struct lys_node * )elem ) != top_smodule ) {
553+ if (!((struct lys_node * )elem )-> parent || (lys_node_module ((struct lys_node * )elem ) != top_smodule )
554+ || schema_all_prefixes ) {
553555 prefix = lys_node_module ((struct lys_node * )elem )-> name ;
554556 } else {
555557 prefix = NULL ;
0 commit comments