Skip to content

Commit d4e16e3

Browse files
committed
info printer BUGFIX printing data nodes of (sub)module
Changed way of parsing data in module and submodules wasn't reflected in info printer. Fixes #173
1 parent 1a6303d commit d4e16e3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/printer_info.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,22 @@ info_print_data_with_include(struct lyout *out, const struct lys_module *mod)
654654
{
655655
int first = 1;
656656
struct lys_node *node;
657+
const struct lys_module *mainmod = lys_main_module(mod);
657658

658659
ly_print(out, "%-*s", INDENT_LEN, "Data: ");
659660

660-
if (mod->data) {
661-
ly_print(out, "%s \"%s\"\n", strnodetype(mod->data->nodetype), mod->data->name);
662-
node = mod->data->next;
663-
first = 0;
661+
if (mainmod->data) {
662+
LY_TREE_FOR(mainmod->data, node) {
663+
if (node->module != mod) {
664+
continue;
665+
}
664666

665-
for (; node; node = node->next) {
666-
ly_print(out, "%*s%s \"%s\"\n", INDENT_LEN, "", strnodetype(node->nodetype), node->name);
667+
if (first) {
668+
ly_print(out, "%s \"%s\"\n", strnodetype(node->nodetype), node->name);
669+
first = 0;
670+
} else {
671+
ly_print(out, "%*s%s \"%s\"\n", INDENT_LEN, "", strnodetype(node->nodetype), node->name);
672+
}
667673
}
668674
}
669675

0 commit comments

Comments
 (0)