types CHANGE change ly_type_store_resolve_prefix() and connect it with identities

Extend the function to cover even the case of default namespace
(unprefixed identifier) to wrap use of internal function. This will keep
a simple interface to resolve prefix for type plugin implementations.

The function was renamed to ly_type_identity_module() to show its
connection with identityref types.
diff --git a/src/plugins_types.c b/src/plugins_types.c
index b344534..e84eb97 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -147,10 +147,27 @@
 }
 
 API const struct lys_module *
-ly_type_store_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len,
-        LY_PREFIX_FORMAT format, void *prefix_data)
+ly_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
+        const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format, void *prefix_data)
 {
-    return ly_resolve_prefix(ctx, prefix, prefix_len, format, prefix_data);
+    if (prefix_len) {
+        return ly_resolve_prefix(ctx, prefix, prefix_len, format, prefix_data);
+    } else {
+        switch (format) {
+        case LY_PREF_SCHEMA:
+        case LY_PREF_SCHEMA_RESOLVED:
+            /* use context node module, handles augments */
+            return ctx_node->module;
+        case LY_PREF_JSON:
+            /* use context node module (as specified) */
+            return ctx_node->module;
+        case LY_PREF_XML:
+            /* use the default namespace */
+            return ly_xml_resolve_prefix(ctx, NULL, 0, prefix_data);
+        }
+    }
+
+    return NULL;
 }
 
 /**
@@ -722,25 +739,7 @@
         goto cleanup;
     }
 
-    if (prefix_len) {
-        mod = ly_type_store_resolve_prefix(ctx, prefix, prefix_len, format, prefix_data);
-    } else {
-        switch (format) {
-        case LY_PREF_SCHEMA:
-        case LY_PREF_SCHEMA_RESOLVED:
-            /* use context node module, handles augments */
-            mod = ctx_node->module;
-            break;
-        case LY_PREF_JSON:
-            /* use context node module (as specified) */
-            mod = ctx_node->module;
-            break;
-        case LY_PREF_XML:
-            /* use the default namespace */
-            mod = ly_xml_resolve_prefix(ctx, NULL, 0, prefix_data);
-            break;
-        }
-    }
+    mod = ly_type_identity_module(ctx, ctx_node, prefix, prefix_len, format, prefix_data);
     if (!mod) {
         ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL,
                 "Invalid identityref \"%.*s\" value - unable to map prefix to YANG schema.", (int)value_len, value);
diff --git a/src/plugins_types.h b/src/plugins_types.h
index fb77c43..9a2a89a 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -127,11 +127,13 @@
         struct ly_err_item **err);
 
 /**
- * @brief Resolve format-specific prefixes to modules.
+ * @brief Get the corresponding module for the identity value.
  *
  * Use only in implementations of ::ly_type_store_clb which provide all the necessary parameters for this function.
  *
  * @param[in] ctx libyang context.
+ * @param[in] ctx_node Schema node where the value is instantiated to determine the module in case of unprefixed value
+ * in specific @p format.
  * @param[in] prefix Prefix to resolve - identified beginning of a prefix in ::ly_type_store_clb's value parameter.
  * @param[in] prefix_len Length of @p prefix.
  * @param[in] format Format of the prefix (::ly_type_store_clb's format parameter).
@@ -139,8 +141,8 @@
  * @return Resolved prefix module,
  * @return NULL otherwise.
  */
-const struct lys_module *ly_type_store_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len,
-        LY_PREFIX_FORMAT format, void *prefix_data);
+const struct lys_module *ly_type_identity_module(const struct ly_ctx *ctx, const struct lysc_node *ctx_node,
+        const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format, void *prefix_data);
 
 /**
  * @brief Get format-specific prefix for a module.