schema compile BUGFIX leafref non-prefixed node module

... should be the same as the context node, not
current module, which is only for schema paths.
Made current module in leafref redundant and some
other minor refactoring was added.

Fixes sysrepo/sysrepo#2481
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 9e8dc96..0c413e0 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1595,7 +1595,7 @@
     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 lysc_prefix *prefixes;    /**< resolved prefixes used in the path */
-    const struct lys_module *cur_mod;/**< current module for the leafref (path) */
+    const struct lys_module *cur_mod;/**< unused, not needed */
     struct lysc_type *realtype;      /**< pointer to the real (first non-leafref in possible leafrefs chain) type. */
     uint8_t require_instance;        /**< require-instance flag */
 };