Skip to content

Commit 6178f9a

Browse files
author
roman
committed
printer context BUGFIX build addr ht first
1 parent 2911183 commit 6178f9a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/printer_context.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,13 +1741,15 @@ ly_ctx_compiled_print_context(const struct ly_ctx *orig_ctx, struct ly_ctx *ctx,
17411741
/* no search paths */
17421742
memset(&ctx->search_paths, 0, sizeof ctx->search_paths);
17431743

1744-
/* modules, referenced */
1744+
/* modules, referenced, 2 loops because of augments (forward reference), build the ht first */
17451745
ctxp_set(&orig_ctx->modules, &ctx->modules, mem);
17461746
for (i = 0; i < ctx->modules.count; ++i) {
17471747
ctx->modules.objs[i] = *mem;
17481748
*mem = (char *)*mem + sizeof(struct lys_module);
17491749

17501750
ly_ctx_compiled_addr_ht_add(addr_ht, orig_ctx->modules.objs[i], ctx->modules.objs[i]);
1751+
}
1752+
for (i = 0; i < ctx->modules.count; ++i) {
17511753
ctxp_module(orig_ctx->modules.objs[i], ctx->modules.objs[i], addr_ht, ptr_set, mem);
17521754
}
17531755

0 commit comments

Comments
 (0)