Skip to content

Commit 4fdf94e

Browse files
committed
printer context BUGFIX size of in/out extensions
Fixes #2447
1 parent 62f54ad commit 4fdf94e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/printer_context.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ ctxs_node(const struct lysc_node *node, struct ly_ht *ht, int *size)
355355
const struct lysc_node_anydata *any;
356356
const struct lysc_node_case *cas;
357357
const struct lysc_node_action *act;
358+
const struct lysc_node_action_inout *inout;
358359
const struct lysc_node_notif *notif;
359360
const struct lysc_node *child;
360361
LY_ARRAY_COUNT_TYPE u;
@@ -453,14 +454,18 @@ ctxs_node(const struct lysc_node *node, struct ly_ht *ht, int *size)
453454
*size += CTXP_MEM_SIZE(sizeof *act);
454455

455456
ctxs_whens((const struct lysc_when **)act->when, ht, size);
456-
LY_LIST_FOR(act->input.child, child) {
457-
ctxs_node(child, ht, size);
458-
}
459-
ctxs_musts(act->input.musts, ht, size);
460-
LY_LIST_FOR(act->output.child, child) {
457+
ctxs_node((struct lysc_node *)&act->input, ht, size);
458+
ctxs_node((struct lysc_node *)&act->output, ht, size);
459+
break;
460+
case LYS_INPUT:
461+
case LYS_OUTPUT:
462+
inout = (const struct lysc_node_action_inout *)node;
463+
/* node a member of rpc/action */
464+
465+
LY_LIST_FOR(inout->child, child) {
461466
ctxs_node(child, ht, size);
462467
}
463-
ctxs_musts(act->output.musts, ht, size);
468+
ctxs_musts(inout->musts, ht, size);
464469
break;
465470
case LYS_NOTIF:
466471
notif = (const struct lysc_node_notif *)node;

tests/utests/schema/test_schema.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,7 @@ test_compiled_print(void **state)
21382138
/* load the base module */
21392139
yang = "module m1 {yang-version 1.1; namespace urn:m1;prefix m1;"
21402140
"import ietf-yang-metadata {prefix md;}"
2141+
"extension a;"
21412142
"identity baseid;"
21422143
"identity id1 {base baseid;}"
21432144
"feature feat;"
@@ -2160,7 +2161,7 @@ test_compiled_print(void **state)
21602161
"}"
21612162
"}"
21622163
"rpc h {"
2163-
" input {leaf a {type string;}}"
2164+
" input {m1:a; leaf a {type string;}}"
21642165
"}"
21652166
"md:annotation i {"
21662167
" description \"test\";"

0 commit comments

Comments
 (0)