types CHANGE extend functions' usability with declaring parameter const
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 4441f4f..4420938 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -44,7 +44,7 @@
* @brief Find import prefix in imports.
*/
static const struct lys_module *
-ly_schema_resolve_prefix(const struct ly_ctx *UNUSED(ctx), const char *prefix, size_t prefix_len, void *prefix_data)
+ly_schema_resolve_prefix(const struct ly_ctx *UNUSED(ctx), const char *prefix, size_t prefix_len, const void *prefix_data)
{
const struct lysp_module *prefix_mod = prefix_data;
struct lys_module *m = NULL;
@@ -75,9 +75,9 @@
*/
static const struct lys_module *
ly_schema_resolved_resolve_prefix(const struct ly_ctx *UNUSED(ctx), const char *prefix, size_t prefix_len,
- void *prefix_data)
+ const void *prefix_data)
{
- struct lysc_prefix *prefixes = prefix_data;
+ const struct lysc_prefix *prefixes = prefix_data;
LY_ARRAY_COUNT_TYPE u;
LY_ARRAY_FOR(prefixes, u) {
@@ -93,7 +93,7 @@
* @brief Find XML namespace prefix in XML namespaces, which are then mapped to modules.
*/
static const struct lys_module *
-ly_xml_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, void *prefix_data)
+ly_xml_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, const void *prefix_data)
{
const struct lys_module *mod;
const struct lyxml_ns *ns;
@@ -116,13 +116,14 @@
* @brief Find module name.
*/
static const struct lys_module *
-ly_json_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, void *UNUSED(prefix_data))
+ly_json_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, const void *UNUSED(prefix_data))
{
return ly_ctx_get_module_implemented2(ctx, prefix, prefix_len);
}
const struct lys_module *
-ly_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format, void *prefix_data)
+ly_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format,
+ const void *prefix_data)
{
const struct lys_module *mod = NULL;
@@ -148,7 +149,7 @@
API 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)
+ const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format, const void *prefix_data)
{
if (prefix_len) {
return ly_resolve_prefix(ctx, prefix, prefix_len, format, prefix_data);
diff --git a/src/plugins_types.h b/src/plugins_types.h
index fdff766..2d139c5 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -143,7 +143,7 @@
* @return NULL otherwise.
*/
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);
+ const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format, const void *prefix_data);
/**
* @brief Implement a module (just like ::lys_set_implemented()), but keep maintaining unresolved items.
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 4632d50..76b890a 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -544,7 +544,7 @@
LY_ERR
ly_store_prefix_data(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_PREFIX_FORMAT format,
- void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p)
+ const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p)
{
LY_ERR ret = LY_SUCCESS;
const char *start, *stop;
diff --git a/src/tree_data_internal.h b/src/tree_data_internal.h
index 184baf6..402f732 100644
--- a/src/tree_data_internal.h
+++ b/src/tree_data_internal.h
@@ -460,7 +460,7 @@
* @return LY_ERR value.
*/
LY_ERR ly_store_prefix_data(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_PREFIX_FORMAT format,
- void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p);
+ const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p);
/**
* @brief Get string name of the format.
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index e226a99..8804f1b 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -836,6 +836,6 @@
* @return NULL otherwise.
*/
const struct lys_module *ly_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len,
- LY_PREFIX_FORMAT format, void *prefix_data);
+ LY_PREFIX_FORMAT format, const void *prefix_data);
#endif /* LY_TREE_SCHEMA_INTERNAL_H_ */