schema tree REFACTOR rename path_context to path_mod
Context module variables are always called mod.
diff --git a/src/plugins_types.c b/src/plugins_types.c
index a930b63..68e547b 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -1747,7 +1747,7 @@
uint32_t i;
/* find all target data instances */
- ret = lyxp_eval(lref->path, LY_PREF_SCHEMA, lref->path_context, node, LYXP_NODE_ELEM, tree, &set, 0);
+ ret = lyxp_eval(lref->path, LY_PREF_SCHEMA, lref->path_mod, node, LYXP_NODE_ELEM, tree, &set, 0);
if (ret) {
ret = LY_ENOTFOUND;
val_str = lref->plugin->print(value, LY_PREF_JSON, NULL, &dynamic);
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 71bf06e..f1a3ced 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1345,7 +1345,7 @@
LY_DATA_TYPE basetype; /**< Base type of the type */
uint32_t refcount; /**< reference counter for type sharing */
struct lyxp_expr *path; /**< parsed target path, compiled path cannot be stored because of type sharing */
- struct lys_module *path_context; /**< module where the path is defined, so it provides context to resolve prefixes */
+ const struct lys_module *path_mod; /**< module where the path is defined, so it provides context to resolve prefixes */
struct lysc_type *realtype; /**< pointer to the real (first non-leafref in possible leafrefs chain) type. */
uint8_t require_instance; /**< require-instance flag */
};
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index e89c1b7..cd445b2 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -1140,12 +1140,12 @@
* @return LY_ERR value.
*/
static LY_ERR
-lys_compile_identity_bases(struct lysc_ctx *ctx, struct lys_module *context_module, const char **bases_p,
+lys_compile_identity_bases(struct lysc_ctx *ctx, const struct lys_module *context_module, const char **bases_p,
struct lysc_ident *ident, struct lysc_ident ***bases)
{
LY_ARRAY_COUNT_TYPE u, v;
const char *s, *name;
- struct lys_module *mod;
+ const struct lys_module *mod;
struct lysc_ident **idref;
assert(ident || bases);
@@ -2749,7 +2749,7 @@
lref->path_mod = type_p->mod;
} else if (base) {
LY_CHECK_RET(lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref *)base)->path, &lref->path));
- lref->path_context = ((struct lysc_type_leafref *)base)->path_context;
+ lref->path_mod = ((struct lysc_type_leafref *)base)->path_mod;
} else if (tpdfname) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LY_VCODE_MISSCHILDSTMT, "path", "leafref type ", tpdfname);
return LY_EVALID;
@@ -2807,7 +2807,7 @@
LY_CHECK_RET(lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref *)un_aux->types[v])->path, &lref->path));
lref->refcount = 1;
lref->require_instance = ((struct lysc_type_leafref *)un_aux->types[v])->require_instance;
- lref->path_context = ((struct lysc_type_leafref *)un_aux->types[v])->path_context;
+ lref->path_mod = ((struct lysc_type_leafref *)un_aux->types[v])->path_mod;
/* TODO extensions */
} else {
@@ -7707,7 +7707,7 @@
/* try to find the target */
LY_CHECK_RET(ly_path_compile(ctx->ctx, node->module, node, lref->path, LY_PATH_LREF_TRUE,
lysc_is_output(node) ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_MANY,
- LY_PREF_SCHEMA, lref->path_context, &p));
+ LY_PREF_SCHEMA, (void *)lref->path_mod, &p));
/* get the target node */
target = p[LY_ARRAY_COUNT(p) - 1].node;
diff --git a/src/xpath.c b/src/xpath.c
index 56cfa2a..146f9dd 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3698,7 +3698,7 @@
/* it was already evaluated on schema, it must succeed */
rc = ly_path_compile(set->ctx, sleaf->module, (struct lysc_node *)sleaf, lref->path, LY_PATH_LREF_TRUE,
- oper, LY_PATH_TARGET_MANY, set->format, lref->path_context, &p);
+ oper, LY_PATH_TARGET_MANY, set->format, (void *)lref->path_mod, &p);
assert(!rc);
/* get the target node */