Skip to content

Commit a23d4a7

Browse files
committed
context REFACTOR minor improvements
1 parent e8046aa commit a23d4a7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/context.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,10 +1417,9 @@ ly_ctx_compiled_print(const struct ly_ctx *ctx, void *mem, void **mem_end)
14171417
pctx = mem;
14181418
mem = (char *)mem + sizeof *pctx;
14191419
ly_ctx_compiled_addr_ht_add(addr_ht, ctx, pctx);
1420-
ly_ctx_compiled_print_context(ctx, pctx, addr_ht, &ptr_set, &mem);
14211420

1422-
/* immutable */
1423-
pctx->opts |= LY_CTX_INT_IMMUTABLE;
1421+
/* members */
1422+
ly_ctx_compiled_print_context(ctx, pctx, addr_ht, &ptr_set, &mem);
14241423

14251424
/* set all the pointers to the printed structures */
14261425
for (i = 0; i < ptr_set.count; ++i) {

src/plugins_exts/schema_mount.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,7 @@ lyplg_ext_schema_mount_destroy_inline_contexts(struct lysc_ext_instance *ext)
586586
if (ly_ctx_is_printed(ext->module->ctx)) {
587587
/* inline mount points not supported in printed context */
588588
assert(sm_data->inln.schema_count == 0);
589-
LOGVRB("Inline mount points not supported in printed context, "
590-
"skipping cleanup of inline mount points.");
589+
LOGVRB("Inline mount points not supported in printed context, skipping cleanup of inline mount points.");
591590
return;
592591
}
593592

src/printer_context.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,9 @@ ly_ctx_compiled_print_context(const struct ly_ctx *orig_ctx, struct ly_ctx *ctx,
17491749
{
17501750
uint32_t i;
17511751

1752+
/* set options so they can be read by other functions */
1753+
ctx->opts = orig_ctx->opts | LY_CTX_INT_IMMUTABLE;
1754+
17521755
/* dictionary */
17531756
ctx->dict.hash_tab = *mem;
17541757
*mem = (char *)*mem + CTXP_MEM_SIZE(sizeof *ctx->dict.hash_tab);
@@ -1779,9 +1782,8 @@ ly_ctx_compiled_print_context(const struct ly_ctx *orig_ctx, struct ly_ctx *ctx,
17791782
/* no unres */
17801783
memset(&ctx->unres, 0, sizeof ctx->unres);
17811784

1782-
/* change_count and options */
1785+
/* change_count, options already set */
17831786
ctx->change_count = orig_ctx->change_count;
1784-
ctx->opts = orig_ctx->opts;
17851787

17861788
/* ctx hash */
17871789
ctx->mod_hash = orig_ctx->mod_hash;

0 commit comments

Comments
 (0)