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 */
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 6867816..b6a753f 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -1668,7 +1668,7 @@
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/a:target1", ((struct lysc_type_leafref*)type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
     assert_int_equal(1, ((struct lysc_type_leafref*)type)->require_instance);
@@ -1676,7 +1676,7 @@
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/a/target2", ((struct lysc_type_leafref*)type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_UINT8, ((struct lysc_type_leafref*)type)->realtype->basetype);
     assert_int_equal(0, ((struct lysc_type_leafref*)type)->require_instance);
@@ -1689,7 +1689,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
     assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
@@ -1703,7 +1703,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
     assert_int_equal(0, ((struct lysc_type_leafref* )type)->require_instance);
@@ -1712,7 +1712,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
 
     /* non-prefixed nodes in path are supposed to be from the module where the leafref type is instantiated */
@@ -1723,7 +1723,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_not_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref*)type)->realtype->basetype);
     assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
@@ -1737,7 +1737,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_BOOL, ((struct lysc_type_leafref*)type)->realtype->basetype);
 
@@ -1752,7 +1752,7 @@
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("../../interface[  name = current()/../ifname ]/address/ip",
                         ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
 
@@ -1765,7 +1765,7 @@
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("/endpoint-parent[id=current()/../field]/endpoint/name", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_context);
+    assert_ptr_equal(mod, ((struct lysc_type_leafref*)type)->path_mod);
     assert_non_null(((struct lysc_type_leafref*)type)->realtype);
     assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);