schema CHANGE move lysc_ext_substmt() into general public API
The function seems useless in (public) extensions plugins API, the
plugins themselves should know best the content of the substatements
information and be able to access them. The helper function is useful
for libyang internal code and libyang users.
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index 56ec4f3..29e1b6b 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -63,25 +63,6 @@
void lysc_extension_instance_substatements_free(struct ly_ctx *ctx, struct lysc_ext_substmt *substmts);
/**
- * @brief Get pointer to the storage of the specified substatement in the given extension instance.
- *
- * The function simplifies access into the ::lysc_ext_instance.substmts sized array.
- *
- * @param[in] ext Compiled extension instance to process.
- * @param[in] substmt Extension substatement to search for.
- * @param[out] instance_p Pointer where the storage of the @p substmt will be provided. The specific type returned depends
- * on the @p substmt and can be found in the documentation of each ::ly_stmt value. Also note that some of the substatements
- * (::lysc_node based or flags) can share the storage with other substatements. In case the pointer is NULL, still the return
- * code can be used to at least know if the substatement is allowed for the extension.
- * @param[out] cardinality_p Pointer to provide allowed cardinality of the substatements in the extension. Note that in some
- * cases, the type of the storage depends also on the cardinality of the substatement.
- * @return LY_SUCCESS if the @p substmt found.
- * @return LY_ENOT in case the @p ext is not able to store (does not allow) the specified @p substmt.
- */
-LY_ERR lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt,
- void **instance_p, enum ly_stmt_cardinality *cardinality_p);
-
-/**
* @brief Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance. The later structure is generally prepared
* and only the extension specific data are supposed to be added (if any).
*
diff --git a/src/schema_compile.c b/src/schema_compile.c
index 3588a7d..d725efb 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -143,7 +143,7 @@
return orig;
}
-LY_ERR
+API LY_ERR
lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt, void **instance_p, enum ly_stmt_cardinality *cardinality_p)
{
LY_ARRAY_COUNT_TYPE u;
diff --git a/src/tree_schema.h b/src/tree_schema.h
index b6c5246..2670781 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -2159,6 +2159,25 @@
struct lysp_feature *lysp_feature_next(const struct lysp_feature *last, const struct lysp_module *pmod, uint32_t *idx);
/**
+ * @brief Get pointer to the storage of the specified substatement in the given extension instance.
+ *
+ * The function simplifies access into the ::lysc_ext_instance.substmts sized array.
+ *
+ * @param[in] ext Compiled extension instance to process.
+ * @param[in] substmt Extension substatement to search for.
+ * @param[out] instance_p Pointer where the storage of the @p substmt will be provided. The specific type returned depends
+ * on the @p substmt and can be found in the documentation of each ::ly_stmt value. Also note that some of the substatements
+ * (::lysc_node based or flags) can share the storage with other substatements. In case the pointer is NULL, still the return
+ * code can be used to at least know if the substatement is allowed for the extension.
+ * @param[out] cardinality_p Pointer to provide allowed cardinality of the substatements in the extension. Note that in some
+ * cases, the type of the storage depends also on the cardinality of the substatement.
+ * @return LY_SUCCESS if the @p substmt found.
+ * @return LY_ENOT in case the @p ext is not able to store (does not allow) the specified @p substmt.
+ */
+LY_ERR lysc_ext_substmt(const struct lysc_ext_instance *ext, enum ly_stmt substmt,
+ void **instance_p, enum ly_stmt_cardinality *cardinality_p);
+
+/**
* @defgroup findxpathoptions Atomize XPath options
* Options to modify behavior of ::lys_find_xpath() and ::lys_find_xpath_atoms() searching for schema nodes in schema tree.
* @{