libyang REFACTOR rename LY_PREFIX_FORMAT values
Reflect that the value format is the primary concern of the enum, the prefix
interpretation is only based on the format.
diff --git a/src/in.c b/src/in.c
index bdc04a2..b175994 100644
--- a/src/in.c
+++ b/src/in.c
@@ -495,7 +495,7 @@
LY_ERR
lyd_parser_create_term(struct lyd_ctx *lydctx, const struct lysc_node *schema, const char *value, size_t value_len,
- ly_bool *dynamic, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, struct lyd_node **node)
+ ly_bool *dynamic, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, struct lyd_node **node)
{
ly_bool incomplete;
@@ -509,7 +509,7 @@
LY_ERR
lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod,
- const char *name, size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format,
+ const char *name, size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format,
void *prefix_data, uint32_t hints)
{
ly_bool incomplete;
diff --git a/src/parser_internal.h b/src/parser_internal.h
index c7d816a..ed37c91 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -208,7 +208,7 @@
* @param[in] hints Data parser's hint for the value's type.
*/
LY_ERR lyd_parser_create_term(struct lyd_ctx *lydctx, const struct lysc_node *schema, const char *value, size_t value_len,
- ly_bool *dynamic, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, struct lyd_node **node);
+ ly_bool *dynamic, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, struct lyd_node **node);
/**
* @brief Wrapper around ::lyd_create_meta() for data parsers.
@@ -229,6 +229,6 @@
*/
LY_ERR lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct lyd_meta **meta,
const struct lys_module *mod, const char *name, size_t name_len, const char *value,
- size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints);
+ size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints);
#endif /* LY_PARSER_INTERNAL_H_ */
diff --git a/src/parser_json.c b/src/parser_json.c
index bea4003..f3442d4 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -355,7 +355,7 @@
goto cleanup;
}
- ret = lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, LY_PREF_JSON, NULL);
+ ret = lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, LY_VALUE_JSON, NULL);
LY_CHECK_GOTO(ret, cleanup);
/* key with a valid value, remove from the set */
@@ -468,7 +468,7 @@
break;
}
- if (lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, LY_PREF_JSON, NULL)) {
+ if (lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, LY_VALUE_JSON, NULL)) {
ret = LY_ENOT;
}
break;
@@ -564,7 +564,7 @@
ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, meta->name.name, strlen(meta->name.name),
meta->name.prefix, ly_strlen(meta->name.prefix), meta->name.module_name,
- ly_strlen(meta->name.module_name), meta->value, ly_strlen(meta->value), NULL, LY_PREF_JSON,
+ ly_strlen(meta->name.module_name), meta->value, ly_strlen(meta->value), NULL, LY_VALUE_JSON,
NULL, meta->hints);
LY_CHECK_GOTO(ret, cleanup);
}
@@ -600,7 +600,7 @@
if (mod) {
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, node, NULL, mod,
meta->name.name, strlen(meta->name.name), meta->value, ly_strlen(meta->value),
- &dynamic, LY_PREF_JSON, NULL, meta->hints);
+ &dynamic, LY_VALUE_JSON, NULL, meta->hints);
LY_CHECK_GOTO(ret, cleanup);
} else if (lydctx->parse_opts & LYD_PARSE_STRICT) {
LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE,
@@ -784,7 +784,7 @@
/* create metadata */
meta = NULL;
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, node, &meta, mod, name, name_len, lydctx->jsonctx->value,
- lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
+ lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_VALUE_JSON, NULL,
LYD_HINT_DATA);
LY_CHECK_GOTO(ret, cleanup);
@@ -800,7 +800,7 @@
/* attr2 is always changed to the created attribute */
ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, name, name_len, prefix, prefix_len, module_name,
module_name_len, lydctx->jsonctx->value, lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic,
- LY_PREF_JSON, NULL, 0);
+ LY_VALUE_JSON, NULL, 0);
LY_CHECK_GOTO(ret, cleanup);
}
/* next member */
@@ -909,7 +909,7 @@
/* create node */
lydjson_get_node_prefix(&parent->node, prefix, prefix_len, &module_name, &module_name_len);
ret = lyd_create_opaq(lydctx->jsonctx->ctx, name, name_len, prefix, prefix_len, module_name, module_name_len, value,
- value_len, &dynamic, LY_PREF_JSON, NULL, type_hint, node_p);
+ value_len, &dynamic, LY_VALUE_JSON, NULL, type_hint, node_p);
if (dynamic) {
free((char *)value);
}
@@ -1057,7 +1057,7 @@
if (snode->nodetype & LYD_NODE_TERM) {
/* create terminal node */
ret = lyd_parser_create_term((struct lyd_ctx *)lydctx, snode, lydctx->jsonctx->value,
- lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
+ lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_VALUE_JSON, NULL,
type_hints, node);
LY_CHECK_RET(ret);
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 070c9c3..f588bd6 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -387,7 +387,7 @@
/* create metadata */
ret = lyd_parser_create_meta((struct lyd_ctx *)lybctx, NULL, meta, mod, meta_name, strlen(meta_name), meta_value,
- ly_strlen(meta_value), &dynamic, LY_PREF_JSON, NULL, LYD_HINT_DATA);
+ ly_strlen(meta_value), &dynamic, LY_VALUE_JSON, NULL, LYD_HINT_DATA);
/* free strings */
free(meta_name);
@@ -422,7 +422,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-lyb_parse_prefix_data(struct lylyb_ctx *lybctx, LY_PREFIX_FORMAT format, void **prefix_data)
+lyb_parse_prefix_data(struct lylyb_ctx *lybctx, LY_VALUE_FORMAT format, void **prefix_data)
{
LY_ERR ret = LY_SUCCESS;
uint8_t count, i;
@@ -430,7 +430,7 @@
struct lyxml_ns *ns = NULL;
switch (format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* read count */
lyb_read(&count, 1, lybctx);
if (!count) {
@@ -455,7 +455,7 @@
*prefix_data = set;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* nothing stored */
break;
default:
@@ -491,7 +491,7 @@
struct lyd_attr *attr2;
char *prefix = NULL, *module_name = NULL, *name = NULL, *value = NULL;
ly_bool dynamic = 0;
- LY_PREFIX_FORMAT format = 0;
+ LY_VALUE_FORMAT format = 0;
void *val_prefix_data = NULL;
/* read count */
@@ -723,7 +723,7 @@
char *value = NULL, *name = NULL, *prefix = NULL, *module_key = NULL;
const char *val_dict;
ly_bool dynamic = 0;
- LY_PREFIX_FORMAT format = 0;
+ LY_VALUE_FORMAT format = 0;
void *val_prefix_data = NULL;
uint32_t prev_lo, flags;
const struct ly_ctx *ctx = lybctx->lybctx->ctx;
@@ -805,7 +805,7 @@
dynamic = 1;
/* create node */
- ret = lyd_parser_create_term((struct lyd_ctx *)lybctx, snode, value, ly_strlen(value), &dynamic, LY_PREF_JSON,
+ ret = lyd_parser_create_term((struct lyd_ctx *)lybctx, snode, value, ly_strlen(value), &dynamic, LY_VALUE_JSON,
NULL, LYD_HINT_DATA, &node);
if (dynamic) {
free(value);
diff --git a/src/parser_xml.c b/src/parser_xml.c
index de48509..e7f3bbb 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -124,7 +124,7 @@
/* create metadata */
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, NULL, meta, mod, name, name_len, xmlctx->value,
- xmlctx->value_len, &xmlctx->dynamic, LY_PREF_XML, &xmlctx->ns, LYD_HINT_DATA);
+ xmlctx->value_len, &xmlctx->dynamic, LY_VALUE_XML, &xmlctx->ns, LYD_HINT_DATA);
LY_CHECK_GOTO(ret, cleanup);
/* next attribute */
@@ -147,7 +147,7 @@
LY_ERR ret = LY_SUCCESS;
const struct lyxml_ns *ns;
void *val_prefix_data;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
struct lyd_attr *attr2;
const char *name, *prefix;
size_t name_len, prefix_len;
@@ -183,7 +183,7 @@
/* get value prefixes */
val_prefix_data = NULL;
- LY_CHECK_GOTO(ret = ly_store_prefix_data(xmlctx->ctx, xmlctx->value, xmlctx->value_len, LY_PREF_XML,
+ LY_CHECK_GOTO(ret = ly_store_prefix_data(xmlctx->ctx, xmlctx->value, xmlctx->value_len, LY_VALUE_XML,
&xmlctx->ns, &format, &val_prefix_data), cleanup);
/* attr2 is always changed to the created attribute */
@@ -248,7 +248,7 @@
assert(xmlctx->status == LYXML_ELEM_CONTENT);
if (i < key_set.count) {
/* validate the value */
- r = lys_value_validate(NULL, snode, xmlctx->value, xmlctx->value_len, LY_PREF_XML, &xmlctx->ns);
+ r = lys_value_validate(NULL, snode, xmlctx->value, xmlctx->value_len, LY_VALUE_XML, &xmlctx->ns);
if (!r) {
/* key with a valid value, remove from the set */
ly_set_rm_index(&key_set, i, NULL);
@@ -346,7 +346,7 @@
if ((*snode)->nodetype & LYD_NODE_TERM) {
/* value may not be valid in which case we parse it as an opaque node */
- if (lys_value_validate(NULL, *snode, xmlctx->value, xmlctx->value_len, LY_PREF_XML, &xmlctx->ns)) {
+ if (lys_value_validate(NULL, *snode, xmlctx->value, xmlctx->value_len, LY_VALUE_XML, &xmlctx->ns)) {
*snode = NULL;
}
} else {
@@ -408,7 +408,7 @@
uint32_t prev_opts;
struct lyd_node *node = NULL, *anchor;
void *val_prefix_data = NULL;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
uint32_t getnext_opts;
assert(parent || first_p);
@@ -512,10 +512,10 @@
xmlctx->dynamic = 0;
xmlctx->value = "";
xmlctx->value_len = 0;
- format = LY_PREF_XML;
+ format = LY_VALUE_XML;
} else {
/* get value prefixes */
- ret = ly_store_prefix_data(xmlctx->ctx, xmlctx->value, xmlctx->value_len, LY_PREF_XML,
+ ret = ly_store_prefix_data(xmlctx->ctx, xmlctx->value, xmlctx->value_len, LY_VALUE_XML,
&xmlctx->ns, &format, &val_prefix_data);
LY_CHECK_GOTO(ret, error);
}
@@ -536,7 +536,7 @@
} else if (snode->nodetype & LYD_NODE_TERM) {
/* create node */
LY_CHECK_GOTO(ret = lyd_parser_create_term((struct lyd_ctx *)lydctx, snode, xmlctx->value, xmlctx->value_len,
- &xmlctx->dynamic, LY_PREF_XML, &xmlctx->ns, LYD_HINT_DATA, &node), error);
+ &xmlctx->dynamic, LY_VALUE_XML, &xmlctx->ns, LYD_HINT_DATA, &node), error);
LOG_LOCSET(snode, node, NULL, NULL);
if (parent && (node->schema->flags & LYS_KEY)) {
@@ -741,7 +741,7 @@
/* create node */
rc = lyd_create_opaq(xmlctx->ctx, name, strlen(name), prefix, prefix_len, uri, strlen(uri), xmlctx->value,
- xmlctx->ws_only ? 0 : xmlctx->value_len, NULL, LY_PREF_XML, NULL, 0, envp);
+ xmlctx->ws_only ? 0 : xmlctx->value_len, NULL, LY_VALUE_XML, NULL, 0, envp);
LY_CHECK_GOTO(rc, cleanup);
/* assign atributes */
@@ -906,7 +906,7 @@
/* create node */
assert(xmlctx->status == LYXML_ELEM_CONTENT);
rc = lyd_create_opaq(xmlctx->ctx, name, name_len, prefix, prefix_len, ns->uri, strlen(ns->uri), xmlctx->value,
- xmlctx->ws_only ? 0 : xmlctx->value_len, NULL, LY_PREF_XML, NULL, 0, &child);
+ xmlctx->ws_only ? 0 : xmlctx->value_len, NULL, LY_VALUE_XML, NULL, 0, &child);
LY_CHECK_GOTO(rc, cleanup);
/* assign atributes */
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 736db1f..b0609c7 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -867,7 +867,7 @@
}
}
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = ctx->parsed_mod;
stmt->kw = kw;
@@ -916,7 +916,7 @@
}
/* store the rest of information */
- e->format = LY_PREF_SCHEMA;
+ e->format = LY_VALUE_SCHEMA;
e->prefix_data = ctx->parsed_mod;
e->parent_stmt = insubstmt;
e->parent_stmt_index = insubstmt_index;
diff --git a/src/parser_yin.c b/src/parser_yin.c
index e3baafe..889d2c3 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -3061,7 +3061,7 @@
LY_CHECK_GOTO(ret = lydict_insert_zc(ctx->xmlctx->ctx, id, &(*element)->stmt), cleanup);
/* store prefix data for the statement */
- LY_CHECK_GOTO(ret = ly_store_prefix_data(ctx->xmlctx->ctx, (*element)->stmt, strlen((*element)->stmt), LY_PREF_XML,
+ LY_CHECK_GOTO(ret = ly_store_prefix_data(ctx->xmlctx->ctx, (*element)->stmt, strlen((*element)->stmt), LY_VALUE_XML,
&ctx->xmlctx->ns, &(*element)->format, &(*element)->prefix_data), cleanup);
} else {
LY_CHECK_GOTO(ret = lydict_insert(ctx->xmlctx->ctx, ctx->xmlctx->name, ctx->xmlctx->name_len, &(*element)->stmt), cleanup);
@@ -3136,7 +3136,7 @@
LY_CHECK_ERR_GOTO(!(*element)->arg, ret = LY_EMEM, cleanup);
/* store prefix data for the argument as well */
- LY_CHECK_GOTO(ret = ly_store_prefix_data(ctx->xmlctx->ctx, (*element)->arg, strlen((*element)->arg), LY_PREF_XML,
+ LY_CHECK_GOTO(ret = ly_store_prefix_data(ctx->xmlctx->ctx, (*element)->arg, strlen((*element)->arg), LY_VALUE_XML,
&ctx->xmlctx->ns, &(*element)->format, &(*element)->prefix_data), cleanup);
}
@@ -3186,7 +3186,7 @@
LY_CHECK_RET(lydict_insert_zc(ctx->xmlctx->ctx, ext_name, &e->name));
/* store prefix data for the name */
- LY_CHECK_RET(ly_store_prefix_data(ctx->xmlctx->ctx, e->name, strlen(e->name), LY_PREF_XML, &ctx->xmlctx->ns,
+ LY_CHECK_RET(ly_store_prefix_data(ctx->xmlctx->ctx, e->name, strlen(e->name), LY_VALUE_XML, &ctx->xmlctx->ns,
&e->format, &e->prefix_data));
e->parent_stmt = subelem;
@@ -3242,7 +3242,7 @@
LY_CHECK_RET(!e->argument, LY_EMEM);
/* store prefix data for the argument as well */
- LY_CHECK_RET(ly_store_prefix_data(ctx->xmlctx->ctx, e->argument, strlen(e->argument), LY_PREF_XML,
+ LY_CHECK_RET(ly_store_prefix_data(ctx->xmlctx->ctx, e->argument, strlen(e->argument), LY_VALUE_XML,
&ctx->xmlctx->ns, &e->format, &e->prefix_data));
/* parser next */
diff --git a/src/path.c b/src/path.c
index a29bd1c..1fbe07b 100644
--- a/src/path.c
+++ b/src/path.c
@@ -395,7 +395,7 @@
static LY_ERR
ly_path_compile_prefix(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
const struct lysc_node *prev_ctx_node, const struct lyxp_expr *expr, uint16_t tok_idx, uint8_t lref,
- LY_PREFIX_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, const struct lys_module **mod,
+ LY_VALUE_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, const struct lys_module **mod,
const char **name, size_t *name_len)
{
LY_ERR ret;
@@ -436,22 +436,22 @@
LOG_LOCBACK(cur_node ? 1 : 0, 0, 0, 0);
} else {
switch (format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
if (!cur_mod) {
LOGINT_RET(ctx);
}
/* use current module */
*mod = cur_mod;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
if (!prev_ctx_node) {
LOGINT_RET(ctx);
}
/* inherit module of the previous node */
*mod = prev_ctx_node->module;
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* not really defined */
LOGINT_RET(ctx);
}
@@ -475,7 +475,7 @@
LY_ERR
ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
- const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx, LY_PREFIX_FORMAT format,
+ const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx, LY_VALUE_FORMAT format,
void *prefix_data, struct ly_path_predicate **predicates, enum ly_path_pred_type *pred_type)
{
LY_ERR ret = LY_SUCCESS;
@@ -652,7 +652,7 @@
*/
static LY_ERR
ly_path_compile_predicate_leafref(const struct lysc_node *ctx_node, const struct lysc_node *cur_node,
- const struct lyxp_expr *expr, uint16_t *tok_idx, LY_PREFIX_FORMAT format, void *prefix_data,
+ const struct lyxp_expr *expr, uint16_t *tok_idx, LY_VALUE_FORMAT format, void *prefix_data,
struct lys_glob_unres *unres)
{
LY_ERR ret = LY_SUCCESS;
@@ -784,7 +784,7 @@
LY_ERR
ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, const struct lysc_node *ctx_node,
const struct lysc_ext_instance *ext, const struct lyxp_expr *expr, uint8_t lref, uint8_t oper, uint8_t target,
- LY_PREFIX_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, struct ly_path **path)
+ LY_VALUE_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, struct ly_path **path)
{
LY_ERR ret = LY_SUCCESS;
uint16_t tok_idx = 0;
diff --git a/src/path.h b/src/path.h
index f3e88b0..2183d71 100644
--- a/src/path.h
+++ b/src/path.h
@@ -172,7 +172,7 @@
*/
LY_ERR ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, const struct lysc_node *ctx_node,
const struct lysc_ext_instance *ext, const struct lyxp_expr *expr, uint8_t lref, uint8_t oper, uint8_t target,
- LY_PREFIX_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, struct ly_path **path);
+ LY_VALUE_FORMAT format, void *prefix_data, struct lys_glob_unres *unres, struct ly_path **path);
/**
* @brief Compile predicate into ly_path_predicate structure. Only simple predicates (not leafref) are supported.
@@ -191,7 +191,7 @@
* @return LY_ERR value.
*/
LY_ERR ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
- const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx, LY_PREFIX_FORMAT format,
+ const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx, LY_VALUE_FORMAT format,
void *prefix_data, struct ly_path_predicate **predicates, enum ly_path_pred_type *pred_type);
/**
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 393cd66..320ae7a 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -120,7 +120,7 @@
}
const struct lys_module *
-ly_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, LY_PREFIX_FORMAT format,
+ly_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format,
const void *prefix_data)
{
const struct lys_module *mod = NULL;
@@ -128,16 +128,16 @@
LY_CHECK_ARG_RET(ctx, prefix, prefix_len, NULL);
switch (format) {
- case LY_PREF_SCHEMA:
+ case LY_VALUE_SCHEMA:
mod = ly_schema_resolve_prefix(ctx, prefix, prefix_len, prefix_data);
break;
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA_RESOLVED:
mod = ly_schema_resolved_resolve_prefix(ctx, prefix, prefix_len, prefix_data);
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
mod = ly_xml_resolve_prefix(ctx, prefix, prefix_len, prefix_data);
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
mod = ly_json_resolve_prefix(ctx, prefix, prefix_len, prefix_data);
break;
}
@@ -147,20 +147,20 @@
API const struct lys_module *
lyplg_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, const void *prefix_data)
+ const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, const void *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:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* use context node module, handles augments */
return ctx_node->module;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* use context node module (as specified) */
return ctx_node->module;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* use the default namespace */
return ly_xml_resolve_prefix(ctx, NULL, 0, prefix_data);
}
@@ -236,21 +236,21 @@
}
const char *
-ly_get_prefix(const struct lys_module *mod, LY_PREFIX_FORMAT format, void *prefix_data)
+ly_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data)
{
const char *prefix = NULL;
switch (format) {
- case LY_PREF_SCHEMA:
+ case LY_VALUE_SCHEMA:
prefix = ly_schema_get_prefix(mod, prefix_data);
break;
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA_RESOLVED:
prefix = ly_schema_resolved_get_prefix(mod, prefix_data);
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
prefix = ly_xml_get_prefix(mod, prefix_data);
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
prefix = ly_json_get_prefix(mod, prefix_data);
break;
}
@@ -259,7 +259,7 @@
}
API const char *
-lyplg_type_get_prefix(const struct lys_module *mod, LY_PREFIX_FORMAT format, void *prefix_data)
+lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data)
{
return ly_get_prefix(mod, format, prefix_data);
}
@@ -279,7 +279,7 @@
}
API const char *
-lyplg_type_print_simple(const struct lyd_value *value, LY_PREFIX_FORMAT UNUSED(format),
+lyplg_type_print_simple(const struct lyd_value *value, LY_VALUE_FORMAT UNUSED(format),
void *UNUSED(prefix_data), ly_bool *dynamic)
{
*dynamic = 0;
@@ -559,8 +559,8 @@
}
API LY_ERR
-lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_PREFIX_FORMAT format,
- const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p)
+lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_VALUE_FORMAT format,
+ const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p)
{
LY_CHECK_ARG_RET(ctx, value, format_p, prefix_data_p, LY_EINVAL);
@@ -569,7 +569,7 @@
}
API LY_ERR
-lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_PREFIX_FORMAT format, const void *orig, void **dup)
+lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup)
{
LY_CHECK_ARG_RET(NULL, dup, LY_EINVAL);
@@ -582,7 +582,7 @@
}
API void
-lyplg_type_prefix_data_free(LY_PREFIX_FORMAT format, void *prefix_data)
+lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data)
{
ly_free_prefix_data(format, prefix_data);
}
@@ -674,7 +674,7 @@
API LY_ERR
lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, size_t value_len, uint32_t options,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
struct lys_glob_unres *unres, struct ly_path **path, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -686,12 +686,12 @@
*err = NULL;
switch (format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
- case LY_PREF_XML:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
+ case LY_VALUE_XML:
prefix_opt = LY_PATH_PREFIX_MANDATORY;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
prefix_opt = LY_PATH_PREFIX_STRICT_INHERIT;
break;
}
@@ -774,11 +774,11 @@
int rc;
/* find all target data instances */
- ret = lyxp_eval(lref->cur_mod->ctx, lref->path, lref->cur_mod, LY_PREF_SCHEMA_RESOLVED, lref->prefixes, node, tree,
+ ret = lyxp_eval(lref->cur_mod->ctx, lref->path, lref->cur_mod, LY_VALUE_SCHEMA_RESOLVED, lref->prefixes, node, tree,
&set, 0);
if (ret) {
ret = LY_ENOTFOUND;
- val_str = lref->plugin->print(value, LY_PREF_JSON, NULL, &dynamic);
+ val_str = lref->plugin->print(value, LY_VALUE_JSON, NULL, &dynamic);
if (asprintf(errmsg, "Invalid leafref value \"%s\" - XPath evaluation error.", val_str) == -1) {
*errmsg = NULL;
ret = LY_EMEM;
@@ -801,7 +801,7 @@
}
if (i == set.used) {
ret = LY_ENOTFOUND;
- val_str = lref->plugin->print(value, LY_PREF_JSON, NULL, &dynamic);
+ val_str = lref->plugin->print(value, LY_VALUE_JSON, NULL, &dynamic);
if (set.used) {
rc = asprintf(errmsg, LY_ERRMSG_NOLREF_VAL, val_str, lref->path->expr);
} else {
diff --git a/src/plugins_types.h b/src/plugins_types.h
index ad687a6..9bc539d 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -232,7 +232,7 @@
* @return NULL otherwise.
*/
const struct lys_module *lyplg_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, const void *prefix_data);
+ const char *prefix, size_t prefix_len, LY_VALUE_FORMAT format, const void *prefix_data);
/**
* @brief Implement a module (just like ::lys_set_implemented()), but keep maintaining unresolved items.
@@ -257,7 +257,7 @@
* @return Module's prefix to print.
* @return NULL on error.
*/
-const char *lyplg_type_get_prefix(const struct lys_module *mod, LY_PREFIX_FORMAT format, void *prefix_data);
+const char *lyplg_type_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Store used prefixes in a string into an internal libyang structure used in ::lyd_value.
@@ -276,8 +276,8 @@
* @param[in,out] prefix_data_p Resulting prefix data for the value in format @p format_p.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_PREFIX_FORMAT format,
- const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p);
+LY_ERR lyplg_type_prefix_data_new(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_VALUE_FORMAT format,
+ const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p);
/**
* @brief Duplicate prefix data.
*
@@ -289,7 +289,7 @@
* @param[out] dup Duplicated prefix data.
* @return LY_ERR value.
*/
-LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_PREFIX_FORMAT format, const void *orig, void **dup);
+LY_ERR lyplg_type_prefix_data_dup(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *orig, void **dup);
/**
* @brief Free internal prefix data.
@@ -299,7 +299,7 @@
* @param[in] format Format of the prefixes.
* @param[in] prefix_data Format-specific data to free.
*/
-void lyplg_type_prefix_data_free(LY_PREFIX_FORMAT format, void *prefix_data);
+void lyplg_type_prefix_data_free(LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Helper function to create internal schema path representation for instance-identifier value representation.
@@ -320,7 +320,7 @@
* @return LY_ERR value on error.
*/
LY_ERR lyplg_type_lypath_new(const struct ly_ctx *ctx, const char *value, size_t value_len, uint32_t options,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_node,
struct lys_glob_unres *unres, struct ly_path **path, struct ly_err_item **err);
/**
@@ -377,7 +377,7 @@
* @return LY_ERR value on error.
*/
typedef LY_ERR (*lyplg_type_store_clb)(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value,
- size_t value_len, uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints,
+ size_t value_len, uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
const struct lysc_node *ctx_node, struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -418,7 +418,7 @@
*
* @param[in] value Value to print.
* @param[in] format Format in which the data are supposed to be printed.
- * Only 2 formats are currently implemented: ::LY_PREFIX_XML and ::LY_PREFIX_JSON.
+ * Only 2 formats are currently implemented: ::LY_VALUE_XML and ::LY_VALUE_JSON.
* @param[in] prefix_data Format-specific data for processing prefixes. In case of using one of the built-in's print
* callback (or ::lyplg_type_print_simple()), the argument is just simply passed in. If you need to handle prefixes
* in the value on your own, there is ::lyplg_type_get_prefix() function to help.
@@ -428,7 +428,7 @@
* can be responsible for freeing allocated memory.
* @return NULL in case of error.
*/
-typedef const char *(*lyplg_type_print_clb)(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+typedef const char *(*lyplg_type_print_clb)(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/**
@@ -505,7 +505,7 @@
* @brief Generic simple printer callback of the canonized value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_simple(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic);
+const char *lyplg_type_print_simple(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic);
/**
* @brief Generic simple duplication callback.
@@ -534,7 +534,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesBinary */
@@ -552,7 +552,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_bits(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -582,7 +582,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_boolean(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesBoolean */
@@ -600,7 +600,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_decimal64(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesDecimal64 */
@@ -618,7 +618,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_empty(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -642,7 +642,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesEnumeration */
@@ -660,7 +660,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -673,7 +673,7 @@
* @brief Printer callback printing identityref value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_identityref(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+const char *lyplg_type_print_identityref(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/** @} pluginsTypesIdentityref */
@@ -691,7 +691,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -704,7 +704,7 @@
* @brief Printer callback printing the instance-identifier value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_instanceid(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+const char *lyplg_type_print_instanceid(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/**
@@ -741,7 +741,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -749,7 +749,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesInteger */
@@ -767,7 +767,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -780,7 +780,7 @@
* @brief Printer callback printing the leafref value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_leafref(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+const char *lyplg_type_print_leafref(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/**
@@ -817,7 +817,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/** @} pluginsTypesString */
@@ -835,7 +835,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -848,7 +848,7 @@
* @brief Printer callback printing the union value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_union(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+const char *lyplg_type_print_union(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/**
@@ -885,7 +885,7 @@
* Implementation of the ::lyplg_type_store_clb.
*/
LY_ERR lyplg_type_store_xpath10(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err);
/**
@@ -898,7 +898,7 @@
* @brief Printer callback printing the xpath1.0 value.
* Implementation of the ::lyplg_type_print_clb.
*/
-const char *lyplg_type_print_xpath10(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data,
+const char *lyplg_type_print_xpath10(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data,
ly_bool *dynamic);
/**
diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c
index 9176929..8c23d64 100644
--- a/src/plugins_types/binary.c
+++ b/src/plugins_types/binary.c
@@ -30,7 +30,7 @@
API LY_ERR
lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/bits.c b/src/plugins_types/bits.c
index b5a3e43..7f51f13 100644
--- a/src/plugins_types/bits.c
+++ b/src/plugins_types/bits.c
@@ -31,7 +31,7 @@
API LY_ERR
lyplg_type_store_bits(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index 83a6b13..c3c9924 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -30,7 +30,7 @@
API LY_ERR
lyplg_type_store_boolean(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/date_and_time.c b/src/plugins_types/date_and_time.c
index 422f3ae..45f1791 100644
--- a/src/plugins_types/date_and_time.c
+++ b/src/plugins_types/date_and_time.c
@@ -97,7 +97,7 @@
*/
static LY_ERR
lyplg_type_store_date_and_time(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/plugins_types/decimal64.c b/src/plugins_types/decimal64.c
index 368254a..0e5eb59 100644
--- a/src/plugins_types/decimal64.c
+++ b/src/plugins_types/decimal64.c
@@ -31,7 +31,7 @@
API LY_ERR
lyplg_type_store_decimal64(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/empty.c b/src/plugins_types/empty.c
index a26347d..7c91048 100644
--- a/src/plugins_types/empty.c
+++ b/src/plugins_types/empty.c
@@ -29,7 +29,7 @@
API LY_ERR
lyplg_type_store_empty(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/enumeration.c b/src/plugins_types/enumeration.c
index cb93c7f..04e1af2 100644
--- a/src/plugins_types/enumeration.c
+++ b/src/plugins_types/enumeration.c
@@ -29,7 +29,7 @@
API LY_ERR
lyplg_type_store_enum(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/hex_string.c b/src/plugins_types/hex_string.c
index 39fa20d..356f9d2 100644
--- a/src/plugins_types/hex_string.c
+++ b/src/plugins_types/hex_string.c
@@ -34,7 +34,7 @@
*/
static LY_ERR
lyplg_type_store_hex_string(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/plugins_types/identityref.c b/src/plugins_types/identityref.c
index 4029654..14e4e92 100644
--- a/src/plugins_types/identityref.c
+++ b/src/plugins_types/identityref.c
@@ -30,7 +30,7 @@
#include "plugins_internal.h" /* LY_TYPE_*_STR */
API const char *
-lyplg_type_print_identityref(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic)
+lyplg_type_print_identityref(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic)
{
char *result = NULL;
@@ -44,7 +44,7 @@
API LY_ERR
lyplg_type_store_identityref(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -147,7 +147,7 @@
storage->ident = ident;
/* get JSON form since there is no canonical */
- str = (char *)lyplg_type_print_identityref(storage, LY_PREF_JSON, NULL, &dyn);
+ str = (char *)lyplg_type_print_identityref(storage, LY_VALUE_JSON, NULL, &dyn);
assert(str && dyn);
ret = lydict_insert_zc(ctx, str, &storage->canonical);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index 0afb4a8..53e8015 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -32,7 +32,7 @@
#include "plugins_internal.h" /* LY_TYPE_*_STR */
API const char *
-lyplg_type_print_instanceid(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic)
+lyplg_type_print_instanceid(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic)
{
LY_ARRAY_COUNT_TYPE u, v;
char *result = NULL;
@@ -42,7 +42,7 @@
return NULL;
}
- if ((format == LY_PREF_XML) || (format == LY_PREF_SCHEMA)) {
+ if ((format == LY_VALUE_XML) || (format == LY_VALUE_SCHEMA)) {
/* everything is prefixed */
LY_ARRAY_FOR(value->target, u) {
ly_strcat(&result, "/%s:%s", lyplg_type_get_prefix(value->target[u].node->module, format, prefix_data),
@@ -89,7 +89,7 @@
}
}
}
- } else if (format == LY_PREF_JSON) {
+ } else if (format == LY_VALUE_JSON) {
/* only the first node or the node changing module is prefixed */
struct lys_module *mod = NULL;
LY_ARRAY_FOR(value->target, u) {
@@ -152,7 +152,7 @@
API LY_ERR
lyplg_type_store_instanceid(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -176,7 +176,7 @@
path = NULL;
/* store JSON string value */
- str = (char *)lyplg_type_print_instanceid(storage, LY_PREF_JSON, NULL, &dyn);
+ str = (char *)lyplg_type_print_instanceid(storage, LY_VALUE_JSON, NULL, &dyn);
assert(str && dyn);
LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, str, &storage->canonical), cleanup);
storage->realtype = type;
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index fec0bc1..977010b 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -30,7 +30,7 @@
API LY_ERR
lyplg_type_store_int(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
@@ -104,7 +104,7 @@
API LY_ERR
lyplg_type_store_uint(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/ip_address.c b/src/plugins_types/ip_address.c
index 46d7bee..3e14819 100644
--- a/src/plugins_types/ip_address.c
+++ b/src/plugins_types/ip_address.c
@@ -69,7 +69,7 @@
*/
static LY_ERR
lyplg_type_store_ip_address(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/plugins_types/ip_prefix.c b/src/plugins_types/ip_prefix.c
index 394c5ef..1ecdb1a 100644
--- a/src/plugins_types/ip_prefix.c
+++ b/src/plugins_types/ip_prefix.c
@@ -194,7 +194,7 @@
*/
static LY_ERR
lyplg_type_store_ipv4_prefix(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -231,7 +231,7 @@
*/
static LY_ERR
lyplg_type_store_ipv6_prefix(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
diff --git a/src/plugins_types/leafref.c b/src/plugins_types/leafref.c
index 740449e..58508d3 100644
--- a/src/plugins_types/leafref.c
+++ b/src/plugins_types/leafref.c
@@ -32,7 +32,7 @@
API LY_ERR
lyplg_type_store_leafref(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -90,7 +90,7 @@
}
API const char *
-lyplg_type_print_leafref(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic)
+lyplg_type_print_leafref(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic)
{
return value->realtype->plugin->print(value, format, prefix_data, dynamic);
}
diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c
index f20a05c..1223fe7 100644
--- a/src/plugins_types/string.c
+++ b/src/plugins_types/string.c
@@ -29,7 +29,7 @@
API LY_ERR
lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
+ uint32_t options, LY_VALUE_FORMAT UNUSED(format), void *UNUSED(prefix_data), uint32_t hints,
const struct lysc_node *UNUSED(ctx_node), struct lyd_value *storage, struct lys_glob_unres *UNUSED(unres),
struct ly_err_item **err)
{
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index 58fbbd6..bd11ec3 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -82,7 +82,7 @@
API LY_ERR
lyplg_type_store_union(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -192,7 +192,7 @@
}
API const char *
-lyplg_type_print_union(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic)
+lyplg_type_print_union(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic)
{
return value->subvalue->value.realtype->plugin->print(&value->subvalue->value, format, prefix_data, dynamic);
}
diff --git a/src/plugins_types/xpath1.0.c b/src/plugins_types/xpath1.0.c
index 0915bf7..f71e9cb 100644
--- a/src/plugins_types/xpath1.0.c
+++ b/src/plugins_types/xpath1.0.c
@@ -36,7 +36,7 @@
struct lyd_value_xpath10 {
struct lyxp_expr *exp;
const struct ly_ctx *ctx;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
void *prefix_data;
};
@@ -58,7 +58,7 @@
*/
static LY_ERR
xpath10_print_token(const char *token, uint16_t tok_len, ly_bool is_nametest, const struct ly_ctx *resolve_ctx,
- LY_PREFIX_FORMAT resolve_format, const void *resolve_prefix_data, LY_PREFIX_FORMAT get_format,
+ LY_VALUE_FORMAT resolve_format, const void *resolve_prefix_data, LY_VALUE_FORMAT get_format,
void *get_prefix_data, const char **prev_prefix, char **token_p, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -99,7 +99,7 @@
/* remember prefix of a nametest */
*prev_prefix = prefix;
}
- } else if (is_nametest && (get_format == LY_PREF_XML) && (len == tok_len) && *prev_prefix) {
+ } else if (is_nametest && (get_format == LY_VALUE_XML) && (len == tok_len) && *prev_prefix) {
/* nametest without a prefix, we must add it */
mem = realloc(str, str_len + strlen(*prev_prefix) + 1 + len + 1);
LY_CHECK_ERR_GOTO(!mem, ret = ly_err_new(err, LY_EMEM, LYVE_DATA, NULL, NULL, "No memory."), cleanup);
@@ -138,7 +138,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-xpath10_print_value(const struct lyd_value_xpath10 *xp_val, LY_PREFIX_FORMAT format, void *prefix_data,
+xpath10_print_value(const struct lyd_value_xpath10 *xp_val, LY_VALUE_FORMAT format, void *prefix_data,
char **str_value, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -199,7 +199,7 @@
API LY_ERR
lyplg_type_store_xpath10(const struct ly_ctx *ctx, const struct lysc_type *type, const char *value, size_t value_len,
- uint32_t options, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
+ uint32_t options, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, const struct lysc_node *ctx_node,
struct lyd_value *storage, struct lys_glob_unres *unres, struct ly_err_item **err)
{
LY_ERR ret = LY_SUCCESS;
@@ -225,9 +225,9 @@
ret = lyxp_expr_parse(ctx, storage->canonical, strlen(storage->canonical), 1, &xp_val->exp);
LY_CHECK_GOTO(ret, cleanup);
- if (format != LY_PREF_JSON) {
+ if (format != LY_VALUE_JSON) {
/* generate canonical (JSON) value */
- ret = xpath10_print_value(xp_val, LY_PREF_JSON, NULL, &canonical, err);
+ ret = xpath10_print_value(xp_val, LY_VALUE_JSON, NULL, &canonical, err);
LY_CHECK_GOTO(ret, cleanup);
/* replace the canonical value */
@@ -244,12 +244,12 @@
}
API const char *
-lyplg_type_print_xpath10(const struct lyd_value *value, LY_PREFIX_FORMAT format, void *prefix_data, ly_bool *dynamic)
+lyplg_type_print_xpath10(const struct lyd_value *value, LY_VALUE_FORMAT format, void *prefix_data, ly_bool *dynamic)
{
char *str_value;
struct ly_err_item *err = NULL;
- if (format == LY_PREF_JSON) {
+ if (format == LY_VALUE_JSON) {
/* canonical */
*dynamic = 0;
return value->canonical;
diff --git a/src/printer_json.c b/src/printer_json.c
index 5c80863..3ac61c8 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -151,9 +151,9 @@
const struct lys_module *mod;
switch (onode->format) {
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
return onode->name.module_name;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
mod = ly_ctx_get_module_implemented_ns(onode->ctx, onode->name.module_ns);
if (!mod) {
return NULL;
@@ -280,7 +280,7 @@
* @return LY_ERR value.
*/
static LY_ERR
-json_print_member2(struct jsonpr_ctx *ctx, const struct lyd_node *parent, LY_PREFIX_FORMAT format,
+json_print_member2(struct jsonpr_ctx *ctx, const struct lyd_node *parent, LY_VALUE_FORMAT format,
const struct ly_opaq_name *name, ly_bool is_attr)
{
const char *module_name = NULL, *name_str;
@@ -292,10 +292,10 @@
const struct lys_module *mod;
switch (format) {
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
module_name = name->module_name;
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
mod = ly_ctx_get_module_implemented_ns(ctx->ctx, name->module_ns);
if (mod) {
module_name = mod->name;
@@ -332,7 +332,7 @@
json_print_value(struct jsonpr_ctx *ctx, const struct lyd_value *val)
{
ly_bool dynamic = 0;
- const char *value = val->realtype->plugin->print(val, LY_PREF_JSON, NULL, &dynamic);
+ const char *value = val->realtype->plugin->print(val, LY_VALUE_JSON, NULL, &dynamic);
/* leafref is not supported */
switch (val->realtype->basetype) {
@@ -459,7 +459,7 @@
if (node->schema && node->meta) {
if (inner) {
- LY_CHECK_RET(json_print_member2(ctx, NULL, LY_PREF_JSON, NULL, 1));
+ LY_CHECK_RET(json_print_member2(ctx, NULL, LY_VALUE_JSON, NULL, 1));
} else {
LY_CHECK_RET(json_print_member(ctx, node, 1));
}
@@ -471,7 +471,7 @@
LEVEL_PRINTED;
} else if (!node->schema && ((struct lyd_node_opaq *)node)->attr) {
if (inner) {
- LY_CHECK_RET(json_print_member2(ctx, NULL, LY_PREF_JSON, NULL, 1));
+ LY_CHECK_RET(json_print_member2(ctx, NULL, LY_VALUE_JSON, NULL, 1));
} else {
LY_CHECK_RET(json_print_member2(ctx, node, ((struct lyd_node_opaq *)node)->format,
&((struct lyd_node_opaq *)node)->name, 1));
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index ba098a7..83ac1e8 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -553,23 +553,19 @@
*
* @param[in] out Out structure.
* @param[in] format Value prefix format.
- * @param[in] prefix_data Format-specific data to print:
- * LY_PREF_SCHEMA - const struct lysp_module * (module used for resolving prefixes from imports)
- * LY_PREF_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
- * LY_PREF_XML - const struct ly_set * (set with defined namespaces stored as ::lyxml_ns)
- * LY_PREF_JSON - NULL
+ * @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] lybctx LYB context.
* @return LY_ERR value.
*/
static LY_ERR
-lyb_print_prefix_data(struct ly_out *out, LY_PREFIX_FORMAT format, const void *prefix_data, struct lylyb_ctx *lybctx)
+lyb_print_prefix_data(struct ly_out *out, LY_VALUE_FORMAT format, const void *prefix_data, struct lylyb_ctx *lybctx)
{
const struct ly_set *set;
const struct lyxml_ns *ns;
uint32_t i;
switch (format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
set = prefix_data;
if (!set) {
/* no prefix data */
@@ -596,7 +592,7 @@
LY_CHECK_RET(lyb_write_string(ns->uri, 0, 1, out, lybctx));
}
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* nothing to print */
break;
default:
diff --git a/src/printer_tree.c b/src/printer_tree.c
index df389cd..286b286 100644
--- a/src/printer_tree.c
+++ b/src/printer_tree.c
@@ -3714,7 +3714,7 @@
ly_parse_nodeid(&id, &prefix, &prefix_len, &name, &name_len);
if (prefix) {
- mod = ly_resolve_prefix(pmod->mod->ctx, prefix, prefix_len, LY_PREF_SCHEMA, pmod);
+ mod = ly_resolve_prefix(pmod->mod->ctx, prefix, prefix_len, LY_VALUE_SCHEMA, pmod);
ret = mod->parsed == pmod;
} else {
ret = 1;
diff --git a/src/printer_xml.c b/src/printer_xml.c
index 2bc3fac..af60e7a 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -105,13 +105,13 @@
}
static const char *
-xml_print_ns_opaq(struct xmlpr_ctx *ctx, LY_PREFIX_FORMAT format, const struct ly_opaq_name *name, uint32_t prefix_opts)
+xml_print_ns_opaq(struct xmlpr_ctx *ctx, LY_VALUE_FORMAT format, const struct ly_opaq_name *name, uint32_t prefix_opts)
{
switch (format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
return xml_print_ns(ctx, name->module_ns, (prefix_opts & LYXML_PREFIX_DEFAULT) ? NULL : name->prefix, prefix_opts);
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
if (name->module_name) {
const struct lys_module *mod = ly_ctx_get_module_latest(ctx->ctx, name->module_name);
if (mod) {
@@ -131,24 +131,20 @@
* @brief Print prefix data.
*
* @param[in] ctx XML printer context.
- * @param[in] format Value prefix format.
- * @param[in] prefix_data Format-specific data to print:
- * LY_PREF_SCHEMA - const struct lysp_module * (module used for resolving prefixes from imports)
- * LY_PREF_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
- * LY_PREF_XML - const struct ly_set * (set with defined namespaces stored as ::lyxml_ns)
- * LY_PREF_JSON - NULL
+ * @param[in] format Value prefix format, only ::LY_VALUE_XML supported.
+ * @param[in] prefix_data Format-specific data for resolving any prefixes (see ::ly_resolve_prefix).
* @param[in] prefix_opts Prefix options changing the meaning of parameters.
* @return LY_ERR value.
*/
static void
-xml_print_ns_prefix_data(struct xmlpr_ctx *ctx, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t prefix_opts)
+xml_print_ns_prefix_data(struct xmlpr_ctx *ctx, LY_VALUE_FORMAT format, void *prefix_data, uint32_t prefix_opts)
{
const struct ly_set *set;
const struct lyxml_ns *ns;
uint32_t i;
switch (format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
set = prefix_data;
for (i = 0; i < set->count; ++i) {
ns = set->objs[i];
@@ -200,7 +196,7 @@
}
#endif
for (meta = node->meta; meta; meta = meta->next) {
- const char *value = meta->value.realtype->plugin->print(&meta->value, LY_PREF_XML, &ns_list, &dynamic);
+ const char *value = meta->value.realtype->plugin->print(&meta->value, LY_VALUE_XML, &ns_list, &dynamic);
/* print namespaces connected with the value's prefixes */
for (uint32_t u = 0; u < ns_list.count; ++u) {
@@ -327,7 +323,7 @@
const char *value;
xml_print_node_open(ctx, &node->node);
- value = ((struct lysc_node_leaf *)node->schema)->type->plugin->print(&node->value, LY_PREF_XML, &ns_list, &dynamic);
+ value = ((struct lysc_node_leaf *)node->schema)->type->plugin->print(&node->value, LY_VALUE_XML, &ns_list, &dynamic);
/* print namespaces connected with the values's prefixes */
for (uint32_t u = 0; u < ns_list.count; ++u) {
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 5833a15..520e6de 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -829,7 +829,7 @@
ly_bool dynamic;
const char *str;
- str = value->realtype->plugin->print(value, LY_PREF_JSON, NULL, &dynamic);
+ str = value->realtype->plugin->print(value, LY_VALUE_JSON, NULL, &dynamic);
ypr_substmt(ctx, LY_STMT_DEFAULT, 0, str, exts);
if (dynamic) {
free((void *)str);
diff --git a/src/schema_compile.c b/src/schema_compile.c
index cb7bc61..7908ea8 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -376,7 +376,7 @@
if (s) {
/* prefixed identity */
name = &s[1];
- mod = ly_resolve_prefix(ctx->ctx, bases_p[u], s - bases_p[u], LY_PREF_SCHEMA, (void *)base_pmod);
+ mod = ly_resolve_prefix(ctx->ctx, bases_p[u], s - bases_p[u], LY_VALUE_SCHEMA, (void *)base_pmod);
} else {
name = bases_p[u];
mod = base_pmod->mod;
@@ -722,7 +722,7 @@
when_list = lysc_node_when(node);
LY_ARRAY_FOR(when_list, u) {
when = when_list[u];
- ret = lyxp_atomize(set->ctx, when->cond, node->module, LY_PREF_SCHEMA_RESOLVED, when->prefixes,
+ ret = lyxp_atomize(set->ctx, when->cond, node->module, LY_VALUE_SCHEMA_RESOLVED, when->prefixes,
when->context, &tmp_set, LYXP_SCNODE_SCHEMA);
if (ret != LY_SUCCESS) {
LOGVAL(set->ctx, LYVE_SEMANTICS, "Invalid when condition \"%s\".", when->cond->expr);
@@ -791,7 +791,7 @@
}
LY_ERR
-lys_compile_expr_implement(const struct ly_ctx *ctx, const struct lyxp_expr *expr, LY_PREFIX_FORMAT format,
+lys_compile_expr_implement(const struct ly_ctx *ctx, const struct lyxp_expr *expr, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool implement, struct lys_glob_unres *unres, const struct lys_module **mod_p)
{
uint32_t i;
@@ -862,7 +862,7 @@
LY_ARRAY_FOR(whens, u) {
/* first check whether all the referenced modules are implemented */
mod = NULL;
- ret = lys_compile_expr_implement(ctx->ctx, whens[u]->cond, LY_PREF_SCHEMA_RESOLVED, whens[u]->prefixes,
+ ret = lys_compile_expr_implement(ctx->ctx, whens[u]->cond, LY_VALUE_SCHEMA_RESOLVED, whens[u]->prefixes,
ctx->ctx->flags & LY_CTX_REF_IMPLEMENTED, unres, &mod);
if (ret) {
goto cleanup;
@@ -873,7 +873,7 @@
}
/* check "when" */
- ret = lyxp_atomize(ctx->ctx, whens[u]->cond, node->module, LY_PREF_SCHEMA_RESOLVED, whens[u]->prefixes,
+ ret = lyxp_atomize(ctx->ctx, whens[u]->cond, node->module, LY_VALUE_SCHEMA_RESOLVED, whens[u]->prefixes,
whens[u]->context, &tmp_set, opts);
if (ret) {
LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Invalid when condition \"%s\".", whens[u]->cond->expr);
@@ -912,7 +912,7 @@
LY_ARRAY_FOR(musts, u) {
/* first check whether all the referenced modules are implemented */
mod = NULL;
- ret = lys_compile_expr_implement(ctx->ctx, musts[u].cond, LY_PREF_SCHEMA_RESOLVED, musts[u].prefixes,
+ ret = lys_compile_expr_implement(ctx->ctx, musts[u].cond, LY_VALUE_SCHEMA_RESOLVED, musts[u].prefixes,
ctx->ctx->flags & LY_CTX_REF_IMPLEMENTED, unres, &mod);
if (ret) {
goto cleanup;
@@ -923,7 +923,7 @@
}
/* check "must" */
- ret = lyxp_atomize(ctx->ctx, musts[u].cond, node->module, LY_PREF_SCHEMA_RESOLVED, musts[u].prefixes, node,
+ ret = lyxp_atomize(ctx->ctx, musts[u].cond, node->module, LY_VALUE_SCHEMA_RESOLVED, musts[u].prefixes, node,
&tmp_set, opts);
if (ret) {
LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Invalid must restriction \"%s\".", musts[u].cond->expr);
@@ -982,7 +982,7 @@
/* try to find the target */
LY_CHECK_RET(ly_path_compile(ctx->ctx, lref->cur_mod, node, NULL, lref->path, LY_PATH_LREF_TRUE,
(node->flags & LYS_IS_OUTPUT) ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_MANY,
- LY_PREF_SCHEMA_RESOLVED, lref->prefixes, unres, &p));
+ LY_VALUE_SCHEMA_RESOLVED, lref->prefixes, unres, &p));
/* get the target node */
target = p[LY_ARRAY_COUNT(p) - 1].node;
@@ -1050,7 +1050,7 @@
struct ly_err_item *err = NULL;
options = (ctx->ctx->flags & LY_CTX_REF_IMPLEMENTED) ? LYPLG_TYPE_STORE_IMPLEMENT : 0;
- ret = type->plugin->store(ctx->ctx, type, dflt, strlen(dflt), options, LY_PREF_SCHEMA, (void *)dflt_pmod,
+ ret = type->plugin->store(ctx->ctx, type, dflt, strlen(dflt), options, LY_VALUE_SCHEMA, (void *)dflt_pmod,
LYD_HINT_SCHEMA, node, storage, unres, &err);
if (ret == LY_ERECOMPILE) {
/* fine, but we need to recompile */
diff --git a/src/schema_compile.h b/src/schema_compile.h
index 6fc060f..c3adbff 100644
--- a/src/schema_compile.h
+++ b/src/schema_compile.h
@@ -235,7 +235,7 @@
* @return LY_SUCCESS on success.
* @return LY_ERR on error.
*/
-LY_ERR lys_compile_expr_implement(const struct ly_ctx *ctx, const struct lyxp_expr *expr, LY_PREFIX_FORMAT format,
+LY_ERR lys_compile_expr_implement(const struct ly_ctx *ctx, const struct lyxp_expr *expr, LY_VALUE_FORMAT format,
void *prefix_data, ly_bool implement, struct lys_glob_unres *unres, const struct lys_module **mod_p);
/**
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index 0b5f852..95d23a5 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -1343,7 +1343,7 @@
ptr = ly_strnchr(nametest, ':', nametest_len);
if (ptr) {
- target_mod = ly_resolve_prefix(ctx, nametest, ptr - nametest, LY_PREF_SCHEMA, (void *)mod);
+ target_mod = ly_resolve_prefix(ctx, nametest, ptr - nametest, LY_VALUE_SCHEMA, (void *)mod);
if (!target_mod) {
LOGVAL(ctx, LYVE_REFERENCE,
"Invalid absolute-schema-nodeid nametest \"%.*s\" - prefix \"%.*s\" not defined in module \"%s\".",
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 17b0696..ed9d42c 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -235,14 +235,14 @@
struct lysc_when **when)
{
LY_ERR ret = LY_SUCCESS;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
*when = calloc(1, sizeof **when);
LY_CHECK_ERR_RET(!(*when), LOGMEM(ctx->ctx), LY_EMEM);
(*when)->refcount = 1;
LY_CHECK_RET(lyxp_expr_parse(ctx->ctx, when_p->cond, 0, 1, &(*when)->cond));
LY_CHECK_RET(lyplg_type_prefix_data_new(ctx->ctx, when_p->cond, strlen(when_p->cond),
- LY_PREF_SCHEMA, ctx->pmod, &format, (void **)&(*when)->prefixes));
+ LY_VALUE_SCHEMA, ctx->pmod, &format, (void **)&(*when)->prefixes));
(*when)->context = (struct lysc_node *)ctx_node;
DUP_STRING_GOTO(ctx->ctx, when_p->dsc, (*when)->dsc, ret, done);
DUP_STRING_GOTO(ctx->ctx, when_p->ref, (*when)->ref, ret, done);
@@ -300,11 +300,11 @@
lys_compile_must(struct lysc_ctx *ctx, struct lysp_restr *must_p, struct lysc_must *must)
{
LY_ERR ret = LY_SUCCESS;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
LY_CHECK_RET(lyxp_expr_parse(ctx->ctx, must_p->arg.str, 0, 1, &must->cond));
LY_CHECK_RET(lyplg_type_prefix_data_new(ctx->ctx, must_p->arg.str, strlen(must_p->arg.str),
- LY_PREF_SCHEMA, must_p->arg.mod, &format, (void **)&must->prefixes));
+ LY_VALUE_SCHEMA, must_p->arg.mod, &format, (void **)&must->prefixes));
DUP_STRING_GOTO(ctx->ctx, must_p->eapptag, must->eapptag, ret, done);
DUP_STRING_GOTO(ctx->ctx, must_p->emsg, must->emsg, ret, done);
DUP_STRING_GOTO(ctx->ctx, must_p->dsc, must->dsc, ret, done);
@@ -1366,7 +1366,7 @@
lref->refcount = 1;
lref->cur_mod = ((struct lysc_type_leafref *)un_aux->types[v])->cur_mod;
lref->require_instance = ((struct lysc_type_leafref *)un_aux->types[v])->require_instance;
- ret = lyplg_type_prefix_data_dup(ctx->ctx, LY_PREF_SCHEMA_RESOLVED,
+ ret = lyplg_type_prefix_data_dup(ctx->ctx, LY_VALUE_SCHEMA_RESOLVED,
((struct lysc_type_leafref *)un_aux->types[v])->prefixes, (void **)&lref->prefixes);
LY_CHECK_GOTO(ret, error);
/* TODO extensions */
@@ -1613,14 +1613,14 @@
lref->require_instance = 1;
}
if (type_p->path) {
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
LY_CHECK_RET(lyxp_expr_dup(ctx->ctx, type_p->path, &lref->path));
LY_CHECK_RET(lyplg_type_prefix_data_new(ctx->ctx, type_p->path->expr, strlen(type_p->path->expr),
- LY_PREF_SCHEMA, type_p->pmod, &format, (void **)&lref->prefixes));
+ LY_VALUE_SCHEMA, type_p->pmod, &format, (void **)&lref->prefixes));
} else if (base) {
LY_CHECK_RET(lyxp_expr_dup(ctx->ctx, ((struct lysc_type_leafref *)base)->path, &lref->path));
- LY_CHECK_RET(lyplg_type_prefix_data_dup(ctx->ctx, LY_PREF_SCHEMA_RESOLVED,
+ LY_CHECK_RET(lyplg_type_prefix_data_dup(ctx->ctx, LY_VALUE_SCHEMA_RESOLVED,
((struct lysc_type_leafref *)base)->prefixes, (void **)&lref->prefixes));
} else if (tpdfname) {
LOGVAL(ctx->ctx, LY_VCODE_MISSCHILDSTMT, "path", "leafref type ", tpdfname);
@@ -2809,7 +2809,7 @@
LY_ERR
lysc_resolve_schema_nodeid(struct lysc_ctx *ctx, const char *nodeid, size_t nodeid_len, const struct lysc_node *ctx_node,
- const struct lys_module *cur_mod, LY_PREFIX_FORMAT format, void *prefix_data, uint16_t nodetype,
+ const struct lys_module *cur_mod, LY_VALUE_FORMAT format, void *prefix_data, uint16_t nodetype,
const struct lysc_node **target, uint16_t *result_flag)
{
LY_ERR ret = LY_EVALID;
@@ -2864,19 +2864,19 @@
}
} else {
switch (format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* use the current module */
mod = cur_mod;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
if (!ctx_node) {
LOGINT_RET(ctx->ctx);
}
/* inherit the module of the previous context node */
mod = ctx_node->module;
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* not really defined */
LOGINT_RET(ctx->ctx);
}
@@ -2981,7 +2981,7 @@
/* unique node must be present */
LY_ARRAY_NEW_RET(ctx->ctx, *unique, key, LY_EMEM);
ret = lysc_resolve_schema_nodeid(ctx, keystr, len, &list->node, uniques[v].mod->mod,
- LY_PREF_SCHEMA, (void *)uniques[v].mod, LYS_LEAF, (const struct lysc_node **)key, &flags);
+ LY_VALUE_SCHEMA, (void *)uniques[v].mod, LYS_LEAF, (const struct lysc_node **)key, &flags);
if (ret != LY_SUCCESS) {
if (ret == LY_EDENIED) {
LOGVAL(ctx->ctx, LYVE_REFERENCE,
@@ -3238,7 +3238,7 @@
name = dflt->str;
}
if (prefix) {
- mod = ly_resolve_prefix(ctx->ctx, prefix, prefix_len, LY_PREF_SCHEMA, (void *)dflt->mod);
+ mod = ly_resolve_prefix(ctx->ctx, prefix, prefix_len, LY_VALUE_SCHEMA, (void *)dflt->mod);
if (!mod) {
LOGVAL(ctx->ctx, LYVE_REFERENCE, "Default case prefix \"%.*s\" not found "
"in imports of \"%s\".", (int)prefix_len, prefix, LYSP_MODULE_NAME(dflt->mod));
@@ -3489,7 +3489,7 @@
}
} else {
/* foreign module, find it first */
- mod = ly_resolve_prefix(ctx->ctx, prefix, prefix_len, LY_PREF_SCHEMA, ctx->pmod);
+ mod = ly_resolve_prefix(ctx->ctx, prefix, prefix_len, LY_VALUE_SCHEMA, ctx->pmod);
if (!mod) {
LOGVAL(ctx->ctx, LYVE_REFERENCE,
"Invalid prefix used for grouping reference.", uses_p->name);
diff --git a/src/schema_compile_node.h b/src/schema_compile_node.h
index 2d762fa..8e6e0a5 100644
--- a/src/schema_compile_node.h
+++ b/src/schema_compile_node.h
@@ -89,7 +89,7 @@
* @return LY_ERR values - LY_ENOTFOUND, LY_EVALID, LY_EDENIED or LY_SUCCESS.
*/
LY_ERR lysc_resolve_schema_nodeid(struct lysc_ctx *ctx, const char *nodeid, size_t nodeid_len,
- const struct lysc_node *ctx_node, const struct lys_module *cur_mod, LY_PREFIX_FORMAT format, void *prefix_data,
+ const struct lysc_node *ctx_node, const struct lys_module *cur_mod, LY_VALUE_FORMAT format, void *prefix_data,
uint16_t nodetype, const struct lysc_node **target, uint16_t *result_flag);
/**
diff --git a/src/schema_features.c b/src/schema_features.c
index 1e7c7fd..b719ac0 100644
--- a/src/schema_features.c
+++ b/src/schema_features.c
@@ -144,7 +144,7 @@
if (prefixed && (ptr = ly_strnchr(name, ':', len))) {
/* we have a prefixed feature */
- mod = ly_resolve_prefix(pmod->mod->ctx, name, ptr - name, LY_PREF_SCHEMA, (void *)pmod);
+ mod = ly_resolve_prefix(pmod->mod->ctx, name, ptr - name, LY_VALUE_SCHEMA, (void *)pmod);
LY_CHECK_RET(!mod, NULL);
pmod = mod->parsed;
diff --git a/src/tree.h b/src/tree.h
index 4b9ca8a..f573504 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -230,14 +230,14 @@
extern const char *ly_data_type2str[LY_DATA_TYPE_COUNT];
/**
- * @brief All kinds of supported prefix mappings to modules.
+ * @brief All kinds of supported value formats and prefix mappings to modules.
*/
typedef enum {
- LY_PREF_SCHEMA, /**< value prefixes map to YANG import prefixes */
- LY_PREF_SCHEMA_RESOLVED, /**< value prefixes map to module structures directly */
- LY_PREF_XML, /**< value prefixes map to XML namespace prefixes */
- LY_PREF_JSON /**< value prefixes map to module names */
-} LY_PREFIX_FORMAT;
+ LY_VALUE_SCHEMA, /**< YANG schema value, prefixes map to YANG import prefixes */
+ LY_VALUE_SCHEMA_RESOLVED, /**< resolved YANG schema value, prefixes map to module structures directly */
+ LY_VALUE_XML, /**< XML data value, prefixes map to XML namespace prefixes */
+ LY_VALUE_JSON /**< JSON data value, prefixes map to module names */
+} LY_VALUE_FORMAT;
/** @} trees */
diff --git a/src/tree_data.c b/src/tree_data.c
index 5ae3bc8..f7404ef 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -56,7 +56,7 @@
LY_ERR
lyd_value_store(const struct ly_ctx *ctx, struct lyd_value *val, const struct lysc_type *type, const char *value,
- size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints,
+ size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
const struct lysc_node *ctx_node, ly_bool *incomplete)
{
LY_ERR ret;
@@ -114,7 +114,7 @@
LY_ERR
lys_value_validate(const struct ly_ctx *ctx, const struct lysc_node *node, const char *value, size_t value_len,
- LY_PREFIX_FORMAT format, void *prefix_data)
+ LY_VALUE_FORMAT format, void *prefix_data)
{
LY_ERR rc = LY_SUCCESS;
struct ly_err_item *err = NULL;
@@ -166,7 +166,7 @@
type = ((struct lysc_node_leaf *)schema)->type;
/* store */
- rc = type->plugin->store(ctx ? ctx : schema->module->ctx, type, value, value_len, 0, LY_PREF_JSON, NULL,
+ rc = type->plugin->store(ctx ? ctx : schema->module->ctx, type, value, value_len, 0, LY_VALUE_JSON, NULL,
LYD_HINT_DATA, schema, &val, NULL, &err);
if (!rc || (rc == LY_EINCOMPLETE)) {
stored = 1;
@@ -237,7 +237,7 @@
/* store the value */
LOG_LOCSET(node->schema, &node->node, NULL, NULL);
- ret = lyd_value_store(ctx, &val, type, value, value_len, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA, node->schema, NULL);
+ ret = lyd_value_store(ctx, &val, type, value, value_len, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA, node->schema, NULL);
LOG_LOCBACK(1, 1, 0, 0);
LY_CHECK_RET(ret);
@@ -630,7 +630,7 @@
LY_ERR
lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, ly_bool *dynamic,
- LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, ly_bool *incomplete, struct lyd_node **node)
+ LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, ly_bool *incomplete, struct lyd_node **node)
{
LY_ERR ret;
struct lyd_node_term *term;
@@ -760,7 +760,7 @@
LY_PATH_PRED_KEYS, &expr), cleanup);
/* compile them */
- LY_CHECK_GOTO(ret = ly_path_compile_predicate(schema->module->ctx, NULL, NULL, schema, expr, &exp_idx, LY_PREF_JSON,
+ LY_CHECK_GOTO(ret = ly_path_compile_predicate(schema->module->ctx, NULL, NULL, schema, expr, &exp_idx, LY_VALUE_JSON,
NULL, &predicates, &pred_type), cleanup);
/* create the list node */
@@ -809,7 +809,7 @@
LY_ERR
lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_len, const char *prefix, size_t pref_len,
const char *module_key, size_t module_key_len, const char *value, size_t value_len, ly_bool *dynamic,
- LY_PREFIX_FORMAT format, void *val_prefix_data, uint32_t hints, struct lyd_node **node)
+ LY_VALUE_FORMAT format, void *val_prefix_data, uint32_t hints, struct lyd_node **node)
{
LY_ERR ret = LY_SUCCESS;
struct lyd_node_opaq *opaq;
@@ -939,7 +939,7 @@
for (key_s = lysc_node_child(schema); key_s && (key_s->flags & LYS_KEY); key_s = key_s->next) {
key_val = va_arg(ap, const char *);
- rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA,
+ rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA,
NULL, &key);
LY_CHECK_GOTO(rc, cleanup);
lyd_insert_node(ret, NULL, key);
@@ -991,7 +991,7 @@
for (key_s = lysc_node_child(schema); key_s && (key_s->flags & LYS_KEY); key_s = key_s->next) {
key_val = va_arg(ap, const char *);
- rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA,
+ rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA,
NULL, &key);
LY_CHECK_GOTO(rc, cleanup);
lyd_insert_node(ret, NULL, key);
@@ -1063,7 +1063,7 @@
schema = lys_find_child(parent ? parent->schema : NULL, module, name, 0, LYD_NODE_TERM, output ? LYS_GETNEXT_OUTPUT : 0);
LY_CHECK_ERR_RET(!schema, LOGERR(ctx, LY_EINVAL, "Term node \"%s\" not found.", name), LY_ENOTFOUND);
- rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA, NULL, &ret);
+ rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA, NULL, &ret);
LY_CHECK_RET(rc);
if (parent) {
lyd_insert_node(parent, NULL, ret);
@@ -1095,7 +1095,7 @@
}
return LY_ENOTFOUND;
}
- rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA, NULL, &ret);
+ rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA, NULL, &ret);
LY_CHECK_RET(rc);
*node = ret;
@@ -1276,7 +1276,7 @@
val_str = "";
}
- return lyd_create_meta(parent, meta, module, name, name_len, val_str, strlen(val_str), NULL, LY_PREF_JSON,
+ return lyd_create_meta(parent, meta, module, name, name_len, val_str, strlen(val_str), NULL, LY_VALUE_JSON,
NULL, LYD_HINT_DATA, clear_dflt, NULL);
}
@@ -1297,14 +1297,14 @@
}
switch (attr->format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
mod = ly_ctx_get_module_implemented_ns(ctx, attr->name.module_ns);
if (!mod) {
LOGERR(ctx, LY_EINVAL, "Module with namespace \"%s\" not found.", attr->name.module_ns);
return LY_ENOTFOUND;
}
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
mod = ly_ctx_get_module_implemented(ctx, attr->name.module_name);
if (!mod) {
LOGERR(ctx, LY_EINVAL, "Module \"%s\" not found.", attr->name.module_name);
@@ -1335,7 +1335,7 @@
}
LY_CHECK_RET(lyd_create_opaq(ctx, name, strlen(name), prefix, prefix ? strlen(prefix) : 0, module_name,
- strlen(module_name), value, strlen(value), NULL, LY_PREF_JSON, NULL, 0, &ret));
+ strlen(module_name), value, strlen(value), NULL, LY_VALUE_JSON, NULL, 0, &ret));
if (parent) {
lyd_insert_node(parent, NULL, ret);
}
@@ -1362,7 +1362,7 @@
}
LY_CHECK_RET(lyd_create_opaq(ctx, name, strlen(name), prefix, prefix ? strlen(prefix) : 0, module_ns,
- strlen(module_ns), value, strlen(value), NULL, LY_PREF_XML, NULL, 0, &ret));
+ strlen(module_ns), value, strlen(value), NULL, LY_VALUE_XML, NULL, 0, &ret));
if (parent) {
lyd_insert_node(parent, NULL, ret);
}
@@ -1407,7 +1407,7 @@
}
LY_CHECK_RET(lyd_create_attr(parent, &ret, ctx, name, name_len, prefix, pref_len, module_name, mod_len, value,
- strlen(value), NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA));
+ strlen(value), NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA));
if (attr) {
*attr = ret;
@@ -1441,7 +1441,7 @@
}
LY_CHECK_RET(lyd_create_attr(parent, &ret, ctx, name, name_len, prefix, pref_len, module_ns,
- module_ns ? strlen(module_ns) : 0, value, strlen(value), NULL, LY_PREF_XML, NULL, LYD_HINT_DATA));
+ module_ns ? strlen(module_ns) : 0, value, strlen(value), NULL, LY_VALUE_XML, NULL, LYD_HINT_DATA));
if (attr) {
*attr = ret;
@@ -1469,7 +1469,7 @@
/* parse the new value */
LOG_LOCSET(term->schema, term, NULL, NULL);
- ret = lyd_value_store(LYD_CTX(term), &val, type, val_str, strlen(val_str), NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA,
+ ret = lyd_value_store(LYD_CTX(term), &val, type, val_str, strlen(val_str), NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA,
term->schema, NULL);
LOG_LOCBACK(term->schema ? 1 : 0, 1, 0, 0);
LY_CHECK_GOTO(ret, cleanup);
@@ -1549,7 +1549,7 @@
/* parse the new value into a new meta structure */
LY_CHECK_GOTO(ret = lyd_create_meta(NULL, &m2, meta->annotation->module, meta->name, strlen(meta->name), val_str,
- strlen(val_str), NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA, 0, NULL), cleanup);
+ strlen(val_str), NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA, 0, NULL), cleanup);
/* compare original and new value */
if (lyd_compare_meta(meta, m2)) {
@@ -1623,7 +1623,7 @@
LY_ARRAY_NEW_RET(schema->module->ctx, path[u].predicates, pred, LY_EMEM);
LY_CHECK_RET(lyd_value_store(schema->module->ctx, &pred->value,
- ((struct lysc_node_leaflist *)schema)->type, value, strlen(value), NULL, LY_PREF_JSON, NULL,
+ ((struct lysc_node_leaflist *)schema)->type, value, strlen(value), NULL, LY_VALUE_JSON, NULL,
LYD_HINT_DATA, schema, NULL));
++((struct lysc_type *)pred->value.realtype)->refcount;
} /* else we have opaq flag and the value is not valid, leave no predicate and then create an opaque node */
@@ -1693,7 +1693,7 @@
/* compile path */
LY_CHECK_GOTO(ret = ly_path_compile(ctx, NULL, parent ? parent->schema : NULL, ext, exp, LY_PATH_LREF_FALSE,
- options & LYD_NEW_PATH_OUTPUT ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_MANY, LY_PREF_JSON,
+ options & LYD_NEW_PATH_OUTPUT ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_MANY, LY_VALUE_JSON,
NULL, NULL, &p), cleanup);
/* check the compiled path before searching existing nodes, it may be shortened */
@@ -1750,7 +1750,7 @@
} else if ((options & LYD_NEW_PATH_OPAQ) && (p[path_idx].pred_type == LY_PATH_PREDTYPE_NONE)) {
/* creating opaque list without keys */
LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0,
- schema->module->name, strlen(schema->module->name), NULL, 0, NULL, LY_PREF_JSON, NULL,
+ schema->module->name, strlen(schema->module->name), NULL, 0, NULL, LY_VALUE_JSON, NULL,
LYD_NODEHINT_LIST, &node), cleanup);
} else {
/* create standard list instance */
@@ -1776,7 +1776,7 @@
/* creating opaque leaf-list */
LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), value,
value ? strlen(value) : 0, schema->module->name, strlen(schema->module->name), NULL, 0, NULL,
- LY_PREF_JSON, NULL, LYD_NODEHINT_LEAFLIST, &node), cleanup);
+ LY_VALUE_JSON, NULL, LYD_NODEHINT_LEAFLIST, &node), cleanup);
break;
}
}
@@ -1792,7 +1792,7 @@
if (val) {
LY_CHECK_GOTO(ret = lyd_create_term2(schema, &p[path_idx].predicates[0].value, &node), cleanup);
} else {
- LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, LY_PREF_JSON, NULL,
+ LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, LY_VALUE_JSON, NULL,
LYD_HINT_DATA, NULL, &node), cleanup);
}
break;
@@ -1812,7 +1812,7 @@
/* creating opaque leaf */
LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), value,
value ? strlen(value) : 0, schema->module->name, strlen(schema->module->name), NULL, 0, NULL,
- LY_PREF_JSON, NULL, 0, &node), cleanup);
+ LY_VALUE_JSON, NULL, 0, &node), cleanup);
break;
}
}
@@ -1823,7 +1823,7 @@
}
/* create a leaf instance */
- LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA,
+ LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA,
NULL, &node), cleanup);
break;
case LYS_ANYDATA:
@@ -2668,7 +2668,7 @@
LY_ERR
lyd_create_meta(struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod, const char *name,
- size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format,
+ size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format,
void *prefix_data, uint32_t hints, ly_bool clear_dflt, ly_bool *incomplete)
{
LY_ERR ret = LY_SUCCESS;
@@ -2752,7 +2752,7 @@
LY_ERR
lyd_create_attr(struct lyd_node *parent, struct lyd_attr **attr, const struct ly_ctx *ctx, const char *name, size_t name_len,
const char *prefix, size_t prefix_len, const char *module_key, size_t module_key_len, const char *value,
- size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format, void *val_prefix_data, uint32_t hints)
+ size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format, void *val_prefix_data, uint32_t hints)
{
LY_ERR ret = LY_SUCCESS;
struct lyd_attr *at, *last;
@@ -2945,12 +2945,12 @@
return LY_ENOT;
}
switch (opaq1->format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
if (lyxml_value_compare(LYD_CTX(node1), opaq1->value, opaq1->val_prefix_data, LYD_CTX(node2), opaq2->value, opaq2->val_prefix_data)) {
return LY_ENOT;
}
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* prefixes in JSON are unique, so it is not necessary to canonize the values */
if (strcmp(opaq1->value, opaq2->value)) {
return LY_ENOT;
@@ -3991,7 +3991,7 @@
/* create a data node and find the instance */
if (schema->nodetype == LYS_LEAFLIST) {
/* target used attributes: schema, hash, value */
- rc = lyd_create_term(schema, key_or_value, val_len, NULL, LY_PREF_JSON, NULL, LYD_HINT_DATA, NULL, &target);
+ rc = lyd_create_term(schema, key_or_value, val_len, NULL, LY_VALUE_JSON, NULL, LYD_HINT_DATA, NULL, &target);
LY_CHECK_RET(rc);
} else {
/* target used attributes: schema, hash, child (all keys) */
@@ -4115,7 +4115,7 @@
LY_CHECK_GOTO(ret, cleanup);
/* evaluate expression */
- ret = lyxp_eval(LYD_CTX(ctx_node), exp, NULL, LY_PREF_JSON, NULL, ctx_node, ctx_node, &xp_set, LYXP_IGNORE_WHEN);
+ ret = lyxp_eval(LYD_CTX(ctx_node), exp, NULL, LY_VALUE_JSON, NULL, ctx_node, ctx_node, &xp_set, LYXP_IGNORE_WHEN);
LY_CHECK_GOTO(ret, cleanup);
/* allocate return set */
@@ -4163,7 +4163,7 @@
/* compile the path */
ret = ly_path_compile(LYD_CTX(ctx_node), NULL, ctx_node->schema, NULL, expr, LY_PATH_LREF_FALSE,
- output ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_SINGLE, LY_PREF_JSON,
+ output ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT, LY_PATH_TARGET_SINGLE, LY_VALUE_JSON,
(void *)LYD_CTX(ctx_node), NULL, &lypath);
LY_CHECK_GOTO(ret, cleanup);
diff --git a/src/tree_data.h b/src/tree_data.h
index 26e1f05..2fa0561 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -551,7 +551,7 @@
struct lyd_value value; /**< representation of the value according to the selected union's subtype
(stored as ::lyd_value.realtype here, in subvalue structure */
const char *original; /**< Original value in the dictionary. */
- LY_PREFIX_FORMAT format; /**< Prefix format of the value. However, this information is also used to decide
+ LY_VALUE_FORMAT format; /**< Prefix format of the value. However, this information is also used to decide
whether a value is valid for the specific format or not on later validations
(instance-identifier in XML looks different than in JSON). */
void *prefix_data; /**< Format-specific data for prefix resolution (see ly_resolve_prefix()) */
@@ -588,8 +588,8 @@
const char *name; /**< node name, without prefix if any was defined */
const char *prefix; /**< identifier used in the qualified name as the prefix, can be NULL */
union {
- const char *module_ns; /**< format ::LY_PREF_XML - XML namespace of the node element */
- const char *module_name; /**< format ::LY_PREF_JSON - (inherited) name of the module of the element */
+ const char *module_ns; /**< format ::LY_VALUE_XML - XML namespace of the node element */
+ const char *module_name; /**< format ::LY_VALUE_JSON - (inherited) name of the module of the element */
};
};
@@ -601,7 +601,7 @@
struct lyd_attr *next; /**< pointer to the next attribute */
struct ly_opaq_name name; /**< attribute name with module information */
const char *value; /**< attribute value */
- LY_PREFIX_FORMAT format; /**< format of the attribute and any prefixes, ::LY_PREF_XML or ::LY_PREF_JSON */
+ LY_VALUE_FORMAT format; /**< format of the attribute and any prefixes, ::LY_VALUE_XML or ::LY_VALUE_JSON */
void *val_prefix_data; /**< format-specific prefix data */
uint32_t hints; /**< additional information about from the data source, see the [hints list](@ref lydhints) */
};
@@ -848,7 +848,7 @@
struct ly_opaq_name name; /**< node name with module information */
const char *value; /**< original value */
- LY_PREFIX_FORMAT format; /**< format of the node and any prefixes, ::LY_PREF_XML or ::LY_PREF_JSON */
+ LY_VALUE_FORMAT format; /**< format of the node and any prefixes, ::LY_VALUE_XML or ::LY_VALUE_JSON */
void *val_prefix_data; /**< format-specific prefix data */
uint32_t hints; /**< additional information about from the data source, see the [hints list](@ref lydhints) */
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 2a2d347..73a5750 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -129,9 +129,9 @@
if (!node->schema) {
opaq = (struct lyd_node_opaq *)node;
switch (opaq->format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
return ly_ctx_get_module_implemented_ns(LYD_CTX(node), opaq->name.module_ns);
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
return ly_ctx_get_module_implemented(LYD_CTX(node), opaq->name.module_name);
default:
return NULL;
@@ -393,7 +393,7 @@
}
void
-ly_free_prefix_data(LY_PREFIX_FORMAT format, void *prefix_data)
+ly_free_prefix_data(LY_VALUE_FORMAT format, void *prefix_data)
{
struct ly_set *ns_list;
struct lysc_prefix *prefixes;
@@ -405,7 +405,7 @@
}
switch (format) {
- case LY_PREF_XML:
+ case LY_VALUE_XML:
ns_list = prefix_data;
for (i = 0; i < ns_list->count; ++i) {
free(((struct lyxml_ns *)ns_list->objs[i])->prefix);
@@ -413,21 +413,21 @@
}
ly_set_free(ns_list, free);
break;
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA_RESOLVED:
prefixes = prefix_data;
LY_ARRAY_FOR(prefixes, u) {
free(prefixes[u].prefix);
}
LY_ARRAY_FREE(prefixes);
break;
- case LY_PREF_SCHEMA:
- case LY_PREF_JSON:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_JSON:
break;
}
}
LY_ERR
-ly_dup_prefix_data(const struct ly_ctx *ctx, LY_PREFIX_FORMAT format, const void *prefix_data,
+ly_dup_prefix_data(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *prefix_data,
void **prefix_data_p)
{
LY_ERR ret = LY_SUCCESS;
@@ -440,10 +440,10 @@
assert(!*prefix_data_p);
switch (format) {
- case LY_PREF_SCHEMA:
+ case LY_VALUE_SCHEMA:
*prefix_data_p = (void *)prefix_data;
break;
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* copy all the value prefixes */
orig_pref = (struct lysc_prefix *)prefix_data;
LY_ARRAY_CREATE_GOTO(ctx, prefixes, LY_ARRAY_COUNT(orig_pref), ret, cleanup);
@@ -458,7 +458,7 @@
LY_ARRAY_INCREMENT(prefixes);
}
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* copy all the namespaces */
LY_CHECK_GOTO(ret = ly_set_new(&ns_list), cleanup);
*prefix_data_p = ns_list;
@@ -477,7 +477,7 @@
LY_CHECK_ERR_GOTO(!ns->uri, LOGMEM(ctx); ret = LY_EMEM, cleanup);
}
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
assert(!prefix_data);
*prefix_data_p = NULL;
break;
@@ -492,8 +492,8 @@
}
LY_ERR
-ly_store_prefix_data(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_PREFIX_FORMAT format,
- const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p)
+ly_store_prefix_data(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_VALUE_FORMAT format,
+ const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p)
{
LY_ERR ret = LY_SUCCESS;
const struct lys_module *mod;
@@ -506,16 +506,16 @@
ly_bool is_prefix;
switch (format) {
- case LY_PREF_SCHEMA:
+ case LY_VALUE_SCHEMA:
/* copy all referenced modules as prefix - module pairs */
if (!*prefix_data_p) {
/* new prefix data */
LY_ARRAY_CREATE_GOTO(ctx, prefixes, 0, ret, cleanup);
- *format_p = LY_PREF_SCHEMA_RESOLVED;
+ *format_p = LY_VALUE_SCHEMA_RESOLVED;
*prefix_data_p = prefixes;
} else {
/* reuse prefix data */
- assert(*format_p == LY_PREF_SCHEMA_RESOLVED);
+ assert(*format_p == LY_VALUE_SCHEMA_RESOLVED);
prefixes = *prefix_data_p;
}
@@ -529,7 +529,7 @@
if (!mod) {
mod = ly_resolve_prefix(ctx, value_iter, substr_len, format, prefix_data);
if (mod) {
- assert(*format_p == LY_PREF_SCHEMA_RESOLVED);
+ assert(*format_p == LY_VALUE_SCHEMA_RESOLVED);
/* store a new prefix - module pair */
LY_ARRAY_NEW_GOTO(ctx, prefixes, val_pref, ret, cleanup);
*prefix_data_p = prefixes;
@@ -542,16 +542,16 @@
}
}
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* copy all referenced namespaces as prefix - namespace pairs */
if (!*prefix_data_p) {
/* new prefix data */
LY_CHECK_GOTO(ret = ly_set_new(&ns_list), cleanup);
- *format_p = LY_PREF_XML;
+ *format_p = LY_VALUE_XML;
*prefix_data_p = ns_list;
} else {
/* reuse prefix data */
- assert(*format_p == LY_PREF_XML);
+ assert(*format_p == LY_VALUE_XML);
ns_list = *prefix_data_p;
}
@@ -579,8 +579,8 @@
}
}
break;
- case LY_PREF_SCHEMA_RESOLVED:
- case LY_PREF_JSON:
+ case LY_VALUE_SCHEMA_RESOLVED:
+ case LY_VALUE_JSON:
if (!*prefix_data_p) {
/* new prefix data - simply copy all the prefix data */
*format_p = format;
@@ -598,16 +598,16 @@
}
const char *
-ly_format2str(LY_PREFIX_FORMAT format)
+ly_format2str(LY_VALUE_FORMAT format)
{
switch (format) {
- case LY_PREF_SCHEMA:
+ case LY_VALUE_SCHEMA:
return "schema imports";
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA_RESOLVED:
return "schema stored mapping";
- case LY_PREF_XML:
+ case LY_VALUE_XML:
return "XML prefixes";
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
return "JSON module names";
default:
break;
diff --git a/src/tree_data_internal.h b/src/tree_data_internal.h
index 05ad5fc..8e084d5 100644
--- a/src/tree_data_internal.h
+++ b/src/tree_data_internal.h
@@ -87,7 +87,7 @@
* @return LY_ERR value if an error occurred.
*/
LY_ERR lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, ly_bool *dynamic,
- LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints, ly_bool *incomplete, struct lyd_node **node);
+ LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints, ly_bool *incomplete, struct lyd_node **node);
/**
* @brief Create a term (leaf/leaf-list) node from a parsed value by duplicating it.
@@ -171,7 +171,7 @@
*/
LY_ERR lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_len, const char *prefix, size_t pref_len,
const char *module_key, size_t module_key_len, const char *value, size_t value_len, ly_bool *dynamic,
- LY_PREFIX_FORMAT format, void *val_prefix_data, uint32_t hints, struct lyd_node **node);
+ LY_VALUE_FORMAT format, void *val_prefix_data, uint32_t hints, struct lyd_node **node);
/**
* @brief Check the existence and create any non-existing implicit siblings, recursively for the created nodes.
@@ -240,7 +240,7 @@
* @return LY_ERR value if an error occurred.
*/
LY_ERR lyd_create_meta(struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod, const char *name,
- size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format,
+ size_t name_len, const char *value, size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format,
void *prefix_data, uint32_t hints, ly_bool clear_dlft, ly_bool *incomplete);
/**
@@ -274,7 +274,7 @@
*/
LY_ERR lyd_create_attr(struct lyd_node *parent, struct lyd_attr **attr, const struct ly_ctx *ctx, const char *name,
size_t name_len, const char *prefix, size_t prefix_len, const char *module_key, size_t module_key_len,
- const char *value, size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format, void *val_prefix_data, uint32_t hints);
+ const char *value, size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format, void *val_prefix_data, uint32_t hints);
/**
* @brief Store and canonize the given @p value into @p val according to the schema node type rules.
@@ -294,7 +294,7 @@
* @return LY_ERR value on error.
*/
LY_ERR lyd_value_store(const struct ly_ctx *ctx, struct lyd_value *val, const struct lysc_type *type, const char *value,
- size_t value_len, ly_bool *dynamic, LY_PREFIX_FORMAT format, void *prefix_data, uint32_t hints,
+ size_t value_len, ly_bool *dynamic, LY_VALUE_FORMAT format, void *prefix_data, uint32_t hints,
const struct lysc_node *ctx_node, ly_bool *incomplete);
/**
@@ -328,7 +328,7 @@
* @return LY_ERR value if an error occurred.
*/
LY_ERR lys_value_validate(const struct ly_ctx *ctx, const struct lysc_node *node, const char *value, size_t value_len,
- LY_PREFIX_FORMAT format, void *prefix_data);
+ LY_VALUE_FORMAT format, void *prefix_data);
/**
* @defgroup datahash Data nodes hash manipulation
@@ -429,7 +429,7 @@
* LY_PREF_XML - const struct ly_set * (set with defined namespaces stored as ::lyxml_ns)
* LY_PREF_JSON - NULL
*/
-void ly_free_prefix_data(LY_PREFIX_FORMAT format, void *prefix_data);
+void ly_free_prefix_data(LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Duplicate prefix data.
@@ -440,7 +440,7 @@
* @param[out] prefix_data_p Duplicated prefix data.
* @return LY_ERR value.
*/
-LY_ERR ly_dup_prefix_data(const struct ly_ctx *ctx, LY_PREFIX_FORMAT format, const void *prefix_data, void **prefix_data_p);
+LY_ERR ly_dup_prefix_data(const struct ly_ctx *ctx, LY_VALUE_FORMAT format, const void *prefix_data, void **prefix_data_p);
/**
* @brief Store used prefixes in a string.
@@ -457,8 +457,8 @@
* @param[in,out] prefix_data_p Resulting prefix data for the value in format @p format_p.
* @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,
- const void *prefix_data, LY_PREFIX_FORMAT *format_p, void **prefix_data_p);
+LY_ERR ly_store_prefix_data(const struct ly_ctx *ctx, const char *value, size_t value_len, LY_VALUE_FORMAT format,
+ const void *prefix_data, LY_VALUE_FORMAT *format_p, void **prefix_data_p);
/**
* @brief Get string name of the format.
@@ -466,6 +466,6 @@
* @param[in] format Format whose name to get.
* @return Format string name.
*/
-const char *ly_format2str(LY_PREFIX_FORMAT format);
+const char *ly_format2str(LY_VALUE_FORMAT format);
#endif /* LY_TREE_DATA_INTERNAL_H_ */
diff --git a/src/tree_schema.c b/src/tree_schema.c
index e6239da..fd446a0 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -493,7 +493,7 @@
LY_CHECK_GOTO(ret, cleanup);
/* atomize expression */
- ret = lyxp_atomize(ctx, exp, NULL, LY_PREF_JSON, NULL, ctx_node, &xp_set, options);
+ ret = lyxp_atomize(ctx, exp, NULL, LY_VALUE_JSON, NULL, ctx_node, &xp_set, options);
LY_CHECK_GOTO(ret, cleanup);
/* allocate return set */
@@ -532,7 +532,7 @@
}
/* atomize expression */
- ret = lyxp_atomize(cur_mod->ctx, expr, cur_mod, LY_PREF_SCHEMA_RESOLVED, (void *)prefixes, ctx_node, &xp_set, options);
+ ret = lyxp_atomize(cur_mod->ctx, expr, cur_mod, LY_VALUE_SCHEMA_RESOLVED, (void *)prefixes, ctx_node, &xp_set, options);
LY_CHECK_GOTO(ret, cleanup);
/* allocate return set */
@@ -584,7 +584,7 @@
LY_CHECK_GOTO(ret, cleanup);
/* atomize expression */
- ret = lyxp_atomize(ctx, exp, NULL, LY_PREF_JSON, NULL, ctx_node, &xp_set, options);
+ ret = lyxp_atomize(ctx, exp, NULL, LY_VALUE_JSON, NULL, ctx_node, &xp_set, options);
LY_CHECK_GOTO(ret, cleanup);
/* allocate return set */
@@ -665,7 +665,7 @@
/* compile */
oper = output ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT;
ret = ly_path_compile(ctx, NULL, ctx_node, NULL, expr, LY_PATH_LREF_FALSE, oper, LY_PATH_TARGET_MANY,
- LY_PREF_JSON, NULL, NULL, &p);
+ LY_VALUE_JSON, NULL, NULL, &p);
LY_CHECK_GOTO(ret, cleanup);
/* resolve */
@@ -699,7 +699,7 @@
/* compile */
oper = output ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT;
ret = ly_path_compile(ctx, NULL, ctx_node, NULL, exp, LY_PATH_LREF_FALSE, oper, LY_PATH_TARGET_MANY,
- LY_PREF_JSON, NULL, NULL, &p);
+ LY_VALUE_JSON, NULL, NULL, &p);
LY_CHECK_GOTO(ret, cleanup);
/* get last node */
@@ -1017,7 +1017,7 @@
LY_CHECK_ERR_RET(!ext_p, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "md_:annotation", 0, &ext_p->name));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "operation", 0, &ext_p->argument));
- ext_p->format = LY_PREF_SCHEMA;
+ ext_p->format = LY_VALUE_SCHEMA;
ext_p->prefix_data = mod;
ext_p->flags = LYS_INTERNAL;
ext_p->parent_stmt = LY_STMT_MODULE;
@@ -1027,7 +1027,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "type", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enumeration", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_TYPE;
@@ -1036,7 +1036,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "merge", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1045,7 +1045,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "replace", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1054,7 +1054,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "create", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1063,7 +1063,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "delete", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1072,7 +1072,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "remove", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1083,7 +1083,7 @@
LY_CHECK_ERR_RET(!ext_p, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "md_:annotation", 0, &ext_p->name));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "type", 0, &ext_p->argument));
- ext_p->format = LY_PREF_SCHEMA;
+ ext_p->format = LY_VALUE_SCHEMA;
ext_p->prefix_data = mod;
ext_p->flags = LYS_INTERNAL;
ext_p->parent_stmt = LY_STMT_MODULE;
@@ -1093,7 +1093,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "type", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enumeration", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_TYPE;
@@ -1102,7 +1102,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "subtree", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1111,7 +1111,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "enum", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "xpath", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_ENUM;
@@ -1122,7 +1122,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "if-feature", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "xpath", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_IF_FEATURE;
}
@@ -1134,7 +1134,7 @@
LY_CHECK_ERR_RET(!ext_p, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "md_:annotation", 0, &ext_p->name));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "select", 0, &ext_p->argument));
- ext_p->format = LY_PREF_SCHEMA;
+ ext_p->format = LY_VALUE_SCHEMA;
ext_p->prefix_data = mod;
ext_p->flags = LYS_INTERNAL;
ext_p->parent_stmt = LY_STMT_MODULE;
@@ -1144,7 +1144,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "type", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "yang_:xpath1.0", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_TYPE;
@@ -1185,7 +1185,7 @@
LY_CHECK_ERR_RET(!ext_p, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "md_:annotation", 0, &ext_p->name));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "default", 0, &ext_p->argument));
- ext_p->format = LY_PREF_SCHEMA;
+ ext_p->format = LY_VALUE_SCHEMA;
ext_p->prefix_data = mod;
ext_p->flags = LYS_INTERNAL;
ext_p->parent_stmt = LY_STMT_MODULE;
@@ -1195,7 +1195,7 @@
LY_CHECK_ERR_RET(!stmt, LOGMEM(mod->mod->ctx), LY_EMEM);
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "type", 0, &stmt->stmt));
LY_CHECK_RET(lydict_insert(mod->mod->ctx, "boolean", 0, &stmt->arg));
- stmt->format = LY_PREF_SCHEMA;
+ stmt->format = LY_VALUE_SCHEMA;
stmt->prefix_data = mod;
stmt->kw = LY_STMT_TYPE;
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 1c4f79f..5393621 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -506,7 +506,7 @@
struct lysp_stmt {
const char *stmt; /**< identifier of the statement */
const char *arg; /**< statement's argument */
- LY_PREFIX_FORMAT format; /**< prefix format of the identifier/argument (::LY_PREF_XML is YIN format) */
+ LY_VALUE_FORMAT format; /**< prefix format of the identifier/argument (::LY_VALUE_XML is YIN format) */
void *prefix_data; /**< Format-specific data for prefix resolution (see ly_resolve_prefix()) */
struct lysp_stmt *next; /**< link to the next statement */
@@ -523,7 +523,7 @@
struct lysp_ext_instance {
const char *name; /**< extension identifier, including possible prefix */
const char *argument; /**< optional value of the extension's argument */
- LY_PREFIX_FORMAT format; /**< prefix format of the extension name/argument (::LY_PREF_XML is YIN format) */
+ LY_VALUE_FORMAT format; /**< prefix format of the extension name/argument (::LY_VALUE_XML is YIN format) */
void *prefix_data; /**< Format-specific data for prefix resolution
(see ly_resolve_prefix()) */
@@ -1379,7 +1379,7 @@
#define LYSP_MODULE_NAME(PMOD) (PMOD->is_submod ? ((struct lysp_submodule *)PMOD)->name : ((struct lysp_module *)PMOD)->mod->name)
/**
- * @brief Compiled prefix data pair mapping of prefixes to modules. In case the format is ::LY_PREF_SCHEMA_RESOLVED,
+ * @brief Compiled prefix data pair mapping of prefixes to modules. In case the format is ::LY_VALUE_SCHEMA_RESOLVED,
* the expected prefix data is a sized array of these structures.
*/
struct lysc_prefix {
@@ -2192,7 +2192,7 @@
*
* @param[in] ctx libyang context to use. May be NULL if @p ctx_node is set.
* @param[in] ctx_node XPath schema context node. Use NULL for the root node.
- * @param[in] xpath Data XPath expression filtering the matching nodes. ::LY_PREF_JSON prefix format is expected.
+ * @param[in] xpath Data XPath expression filtering the matching nodes. ::LY_VALUE_JSON prefix format is expected.
* @param[in] options Whether to apply some node access restrictions, see @ref findxpathoptions.
* @param[out] set Set of found atoms (schema nodes).
* @return LY_SUCCESS on success, @p set is returned.
@@ -2221,7 +2221,7 @@
*
* @param[in] ctx libyang context to use for absolute @p xpath. May be NULL if @p ctx_node is set.
* @param[in] ctx_node XPath schema context node for relative @p xpath. Use NULL for the root node.
- * @param[in] xpath Data XPath expression filtering the matching nodes. ::LY_PREF_JSON prefix format is expected.
+ * @param[in] xpath Data XPath expression filtering the matching nodes. ::LY_VALUE_JSON prefix format is expected.
* @param[in] options Whether to apply some node access restrictions, see @ref findxpathoptions.
* @param[out] set Set of found schema nodes.
* @return LY_SUCCESS on success, @p set is returned.
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 110da25..8dfc758 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -537,7 +537,7 @@
return;
}
lyxp_expr_free(ctx, (*w)->cond);
- ly_free_prefix_data(LY_PREF_SCHEMA_RESOLVED, (*w)->prefixes);
+ ly_free_prefix_data(LY_VALUE_SCHEMA_RESOLVED, (*w)->prefixes);
lydict_remove(ctx, (*w)->dsc);
lydict_remove(ctx, (*w)->ref);
FREE_ARRAY(ctx, (*w)->exts, lysc_ext_instance_free);
@@ -548,7 +548,7 @@
lysc_must_free(struct ly_ctx *ctx, struct lysc_must *must)
{
lyxp_expr_free(ctx, must->cond);
- ly_free_prefix_data(LY_PREF_SCHEMA_RESOLVED, must->prefixes);
+ ly_free_prefix_data(LY_VALUE_SCHEMA_RESOLVED, must->prefixes);
lydict_remove(ctx, must->emsg);
lydict_remove(ctx, must->eapptag);
lydict_remove(ctx, must->dsc);
@@ -650,7 +650,7 @@
break;
case LY_TYPE_LEAFREF:
lyxp_expr_free(ctx, ((struct lysc_type_leafref *)type)->path);
- ly_free_prefix_data(LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes);
+ ly_free_prefix_data(LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes);
break;
case LY_TYPE_INST:
case LY_TYPE_BOOL:
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index a3435f3..7832354 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -229,7 +229,7 @@
*node = NULL;
str = strchr(id, ':');
if (str) {
- mod = ly_resolve_prefix(start_module->mod->ctx, id, str - id, LY_PREF_SCHEMA, (void *)start_module);
+ mod = ly_resolve_prefix(start_module->mod->ctx, id, str - id, LY_VALUE_SCHEMA, (void *)start_module);
local_module = mod ? mod->parsed : NULL;
name = str + 1;
*type = LY_TYPE_UNKNOWN;
@@ -1902,7 +1902,7 @@
return LY_SUCCESS;
}
- if (ext_p->format == LY_PREF_XML) {
+ if (ext_p->format == LY_VALUE_XML) {
/* Schema was parsed from YIN and an argument is expected, ... */
struct lysp_stmt *stmt = NULL;
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 28b3d1f..ed05847 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -781,15 +781,15 @@
*
* @param[in] mod Module whose prefix to get.
* @param[in] format Format of the prefix.
- * @param[in] prefix_data Format-specific data:
- * LY_PREF_SCHEMA - const struct lysp_module * (module used for resolving imports to prefixes)
- * LY_PREF_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
- * LY_PREF_XML - struct ly_set * (set of all returned modules as ::struct lys_module)
- * LY_PREF_JSON - NULL
+ * @param[in] prefix_data Format-specific data based on @p format:
+ * LY_VALUE_SCHEMA - const struct lysp_module * (module used for resolving imports to prefixes)
+ * LY_VALUE_SCHEMA_RESOLVED - struct lyd_value_prefix * (sized array of pairs: prefix - module)
+ * LY_VALUE_XML - struct ly_set * (set of all returned modules as ::struct lys_module)
+ * LY_VALUE_JSON - NULL
* @return Module prefix to print.
* @return NULL on error.
*/
-const char *ly_get_prefix(const struct lys_module *mod, LY_PREFIX_FORMAT format, void *prefix_data);
+const char *ly_get_prefix(const struct lys_module *mod, LY_VALUE_FORMAT format, void *prefix_data);
/**
* @brief Resolve format-specific prefixes to modules.
@@ -809,6 +809,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, const void *prefix_data);
+ LY_VALUE_FORMAT format, const void *prefix_data);
#endif /* LY_TREE_SCHEMA_INTERNAL_H_ */
diff --git a/src/validation.c b/src/validation.c
index 7dfb498..78feeb5 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -151,7 +151,7 @@
/* evaluate when */
memset(&xp_set, 0, sizeof xp_set);
- ret = lyxp_eval(LYD_CTX(node), when->cond, schema->module, LY_PREF_SCHEMA_RESOLVED, when->prefixes,
+ ret = lyxp_eval(LYD_CTX(node), when->cond, schema->module, LY_VALUE_SCHEMA_RESOLVED, when->prefixes,
ctx_node, tree, &xp_set, LYXP_SCHEMA);
lyxp_set_cast(&xp_set, LYXP_SET_BOOLEAN);
@@ -1105,7 +1105,7 @@
}
/* get canonical string value */
- str = val->realtype->plugin->print(val, LY_PREF_JSON, NULL, &dynamic);
+ str = val->realtype->plugin->print(val, LY_VALUE_JSON, NULL, &dynamic);
hash = dict_hash_multi(hash, str, strlen(str));
if (dynamic) {
free((char *)str);
@@ -1292,7 +1292,7 @@
memset(&xp_set, 0, sizeof xp_set);
/* evaluate must */
- LY_CHECK_RET(lyxp_eval(LYD_CTX(node), musts[u].cond, node->schema->module, LY_PREF_SCHEMA_RESOLVED,
+ LY_CHECK_RET(lyxp_eval(LYD_CTX(node), musts[u].cond, node->schema->module, LY_VALUE_SCHEMA_RESOLVED,
musts[u].prefixes, node, tree, &xp_set, LYXP_SCHEMA));
/* check the result */
diff --git a/src/xml.c b/src/xml.c
index 3738dd1..2f027b4 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1135,10 +1135,10 @@
mod1 = mod2 = NULL;
if (val_prefix_data1) {
/* find module of the first prefix, if any */
- mod1 = ly_resolve_prefix(ctx1, value1_iter, value1_len, LY_PREF_XML, val_prefix_data1);
+ mod1 = ly_resolve_prefix(ctx1, value1_iter, value1_len, LY_VALUE_XML, val_prefix_data1);
}
if (val_prefix_data2) {
- mod2 = ly_resolve_prefix(ctx2, value2_iter, value2_len, LY_PREF_XML, val_prefix_data2);
+ mod2 = ly_resolve_prefix(ctx2, value2_iter, value2_len, LY_VALUE_XML, val_prefix_data2);
}
if (!mod1 || !mod2) {
/* not a prefix or maps to different namespaces */
diff --git a/src/xpath.c b/src/xpath.c
index 01de7c2..450968b 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3724,7 +3724,7 @@
/* it was already evaluated on schema, it must succeed */
rc = ly_path_compile(set->ctx, lref->cur_mod, &sleaf->node, NULL, lref->path, LY_PATH_LREF_TRUE, oper,
- LY_PATH_TARGET_MANY, LY_PREF_SCHEMA_RESOLVED, lref->prefixes, NULL, &p);
+ LY_PATH_TARGET_MANY, LY_VALUE_SCHEMA_RESOLVED, lref->prefixes, NULL, &p);
assert(!rc);
/* get the target node */
@@ -5314,12 +5314,12 @@
mod = NULL;
} else {
switch (set->format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* current module */
mod = set->cur_mod;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* inherit parent (context node) module */
if (ctx_scnode) {
mod = ctx_scnode->module;
@@ -5327,7 +5327,7 @@
mod = NULL;
}
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* all nodes need to be prefixed */
LOGVAL(set->ctx, LYVE_DATA, "Non-prefixed node \"%.*s\" in XML xpath found.", *qname_len, *qname);
return LY_EVALID;
@@ -5383,18 +5383,18 @@
{
if (!moveto_mod && (!node_name || strcmp(node_name, "*"))) {
switch (set->format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* use current module */
moveto_mod = set->cur_mod;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* inherit module of the context node, if any */
if (ctx_node) {
moveto_mod = ctx_node->schema->module;
}
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* not defined */
LOGINT(set->ctx);
return LY_EINVAL;
@@ -5444,18 +5444,18 @@
{
if (!moveto_mod && (!node_name || strcmp(node_name, "*"))) {
switch (set->format) {
- case LY_PREF_SCHEMA:
- case LY_PREF_SCHEMA_RESOLVED:
+ case LY_VALUE_SCHEMA:
+ case LY_VALUE_SCHEMA_RESOLVED:
/* use current module */
moveto_mod = set->cur_mod;
break;
- case LY_PREF_JSON:
+ case LY_VALUE_JSON:
/* inherit module of the context node, if any */
if (ctx_scnode) {
moveto_mod = ctx_scnode->module;
}
break;
- case LY_PREF_XML:
+ case LY_VALUE_XML:
/* not defined */
LOGINT(set->ctx);
return LY_EINVAL;
@@ -6917,7 +6917,7 @@
*/
static LY_ERR
eval_name_test_try_compile_predicates(const struct lyxp_expr *exp, uint16_t *tok_idx, const struct lysc_node *ctx_node,
- const struct lys_module *cur_mod, const struct lysc_node *cur_node, LY_PREFIX_FORMAT format, void *prefix_data,
+ const struct lys_module *cur_mod, const struct lysc_node *cur_node, LY_VALUE_FORMAT format, void *prefix_data,
struct ly_path_predicate **predicates, enum ly_path_pred_type *pred_type)
{
LY_ERR ret = LY_SUCCESS;
@@ -7023,19 +7023,19 @@
*/
static LY_ERR
eval_name_test_with_predicate_get_scnode(const struct ly_ctx *ctx, const struct lyd_node *node, const char *name,
- uint16_t name_len, const struct lys_module *moveto_mod, enum lyxp_node_type root_type, LY_PREFIX_FORMAT format,
+ uint16_t name_len, const struct lys_module *moveto_mod, enum lyxp_node_type root_type, LY_VALUE_FORMAT format,
const struct lysc_node **found)
{
const struct lysc_node *scnode;
const struct lys_module *mod;
uint32_t idx = 0;
- assert((format == LY_PREF_JSON) || moveto_mod);
+ assert((format == LY_VALUE_JSON) || moveto_mod);
continue_search:
scnode = NULL;
if (!node) {
- if ((format == LY_PREF_JSON) && !moveto_mod) {
+ if ((format == LY_VALUE_JSON) && !moveto_mod) {
/* search all modules for a single match */
while ((mod = ly_ctx_get_module_iter(ctx, &idx))) {
scnode = lys_find_child(NULL, mod, name, name_len, 0, 0);
@@ -7054,7 +7054,7 @@
scnode = lys_find_child(NULL, moveto_mod, name, name_len, 0, 0);
}
} else if (!*found || (lysc_data_parent(*found) != node->schema)) {
- if ((format == LY_PREF_JSON) && !moveto_mod) {
+ if ((format == LY_VALUE_JSON) && !moveto_mod) {
/* we must adjust the module to inherit the one from the context node */
moveto_mod = node->schema->module;
}
@@ -7135,7 +7135,7 @@
rc = moveto_resolve_model(&ncname, &ncname_len, set, NULL, &moveto_mod);
LY_CHECK_GOTO(rc, cleanup);
- if (((set->format == LY_PREF_JSON) || moveto_mod) && !attr_axis && !all_desc && (set->type == LYXP_SET_NODE_SET)) {
+ if (((set->format == LY_VALUE_JSON) || moveto_mod) && !attr_axis && !all_desc && (set->type == LYXP_SET_NODE_SET)) {
/* find the matching schema node in some parent in the context */
for (uint32_t i = 0; i < set->used; ++i) {
if (eval_name_test_with_predicate_get_scnode(set->ctx, set->val.nodes[i].node, ncname, ncname_len,
@@ -8479,14 +8479,14 @@
LY_ERR
lyxp_eval(const struct ly_ctx *ctx, const struct lyxp_expr *exp, const struct lys_module *cur_mod,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lyd_node *ctx_node, const struct lyd_node *tree,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lyd_node *ctx_node, const struct lyd_node *tree,
struct lyxp_set *set, uint32_t options)
{
uint16_t tok_idx = 0;
LY_ERR rc;
LY_CHECK_ARG_RET(ctx, ctx, exp, set, LY_EINVAL);
- if (!cur_mod && ((format == LY_PREF_SCHEMA) || (format == LY_PREF_SCHEMA_RESOLVED))) {
+ if (!cur_mod && ((format == LY_VALUE_SCHEMA) || (format == LY_VALUE_SCHEMA_RESOLVED))) {
LOGARG(NULL, "Current module must be set if schema format is used.");
return LY_EINVAL;
}
@@ -8755,14 +8755,14 @@
LY_ERR
lyxp_atomize(const struct ly_ctx *ctx, const struct lyxp_expr *exp, const struct lys_module *cur_mod,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lysc_node *ctx_scnode, struct lyxp_set *set,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_scnode, struct lyxp_set *set,
uint32_t options)
{
LY_ERR ret;
uint16_t tok_idx = 0;
LY_CHECK_ARG_RET(ctx, ctx, exp, set, LY_EINVAL);
- if (!cur_mod && ((format == LY_PREF_SCHEMA) || (format == LY_PREF_SCHEMA_RESOLVED))) {
+ if (!cur_mod && ((format == LY_VALUE_SCHEMA) || (format == LY_VALUE_SCHEMA_RESOLVED))) {
LOGARG(NULL, "Current module must be set if schema format is used.");
return LY_EINVAL;
}
diff --git a/src/xpath.h b/src/xpath.h
index 8224dfe..4da73ad 100644
--- a/src/xpath.h
+++ b/src/xpath.h
@@ -264,7 +264,7 @@
const struct lysc_node *context_op;
const struct lyd_node *tree;
const struct lys_module *cur_mod;
- LY_PREFIX_FORMAT format;
+ LY_VALUE_FORMAT format;
void *prefix_data;
};
@@ -295,7 +295,7 @@
* @return LY_EINVAL, LY_EMEM, LY_EINT for other errors.
*/
LY_ERR lyxp_eval(const struct ly_ctx *ctx, const struct lyxp_expr *exp, const struct lys_module *cur_mod,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lyd_node *ctx_node, const struct lyd_node *tree,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lyd_node *ctx_node, const struct lyd_node *tree,
struct lyxp_set *set, uint32_t options);
/**
@@ -312,7 +312,7 @@
* @return LY_ERR (same as ::lyxp_eval()).
*/
LY_ERR lyxp_atomize(const struct ly_ctx *ctx, const struct lyxp_expr *exp, const struct lys_module *cur_mod,
- LY_PREFIX_FORMAT format, void *prefix_data, const struct lysc_node *ctx_scnode, struct lyxp_set *set,
+ LY_VALUE_FORMAT format, void *prefix_data, const struct lysc_node *ctx_scnode, struct lyxp_set *set,
uint32_t options);
/* used only internally, maps with @ref findxpathoptions */
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index d0b479c..c253c7a 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -377,7 +377,7 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0, LY_PREF_JSON, "foo3", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0, LY_VALUE_JSON, "foo3", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
@@ -388,7 +388,7 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_JSON, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_JSON, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
@@ -399,19 +399,19 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_JSON, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_JSON, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
data = "{\"a:l1\":[{\"a\":\"val_a\",\"b\":\"val_b\",\"c\":{\"val\":\"val_c\"}}]}";
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_JSON, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_JSON, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
data = "{\"a:l1\":[{\"a\":\"val_a\",\"b\":\"val_b\"}]}";
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_JSON, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_JSON, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
}
@@ -458,10 +458,10 @@
1, LYS_CONTAINER, 0, 0, NULL, 0);
node = lyd_child(node);
/* z has no value */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_PREF_JSON, "z", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_VALUE_JSON, "z", 0, 0, NULL, 0, "");
node = node->parent->next;
/* l1 key c has invalid value so it is at the end */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_PREF_JSON, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_VALUE_JSON, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index 3d26002..ba79548 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -247,7 +247,7 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0, LY_PREF_XML, "foo3", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0, LY_VALUE_XML, "foo3", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS, "<foo3 xmlns=\"urn:tests:a\"/>\n");
lyd_free_all(tree);
@@ -262,7 +262,7 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_XML, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_XML, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
@@ -277,7 +277,7 @@
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_PREF_XML, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 0x1, LY_VALUE_XML, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS, data);
lyd_free_all(tree);
@@ -346,10 +346,10 @@
node = lyd_child(node);
/* z has no value */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_PREF_XML, "z", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_VALUE_XML, "z", 0, 0, NULL, 0, "");
node = node->parent->next;
/* l1 key c has invalid value so it is at the end */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_PREF_XML, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_VALUE_XML, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS,
"<edit-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
@@ -524,7 +524,7 @@
assert_non_null(op);
node = tree;
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 1, 0, LY_PREF_XML, "rpc", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 1, 0, LY_VALUE_XML, "rpc", 0, 0, 0, 0, "");
assert_non_null(tree);
@@ -542,10 +542,10 @@
node = lyd_child(node);
/* z has no value */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_PREF_XML, "z", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0, LY_VALUE_XML, "z", 0, 0, NULL, 0, "");
node = node->parent->next;
/* l1 key c has invalid value so it is at the end */
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_PREF_XML, "l1", 0, 0, NULL, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)node, 0x1, 0x1, LY_VALUE_XML, "l1", 0, 0, NULL, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS,
"<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"25\"/>\n");
@@ -593,8 +593,8 @@
assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, NULL, in, LYD_XML, LYD_TYPE_RPC_NETCONF, &tree, &op));
ly_in_free(in, 0);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_PREF_XML, "rpc", 0, 0, 0, 0, "");
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_PREF_XML, "action", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_VALUE_XML, "rpc", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_VALUE_XML, "action", 0, 0, 0, 0, "");
assert_non_null(op);
CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
@@ -647,8 +647,8 @@
assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, NULL, in, LYD_XML, LYD_TYPE_NOTIF_NETCONF, &tree, &op2));
ly_in_free(in, 0);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 1, LY_PREF_XML, "notification", 0, 0, 0, 0, "");
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_PREF_XML, "eventTime", 0, 0, 0, 0,
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 0, 1, LY_VALUE_XML, "notification", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_VALUE_XML, "eventTime", 0, 0, 0, 0,
"2010-12-06T08:00:01Z");
assert_non_null(op2);
@@ -674,7 +674,7 @@
assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, op, in, LYD_XML, LYD_TYPE_REPLY_NETCONF, &tree, NULL));
ly_in_free(in, 0);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 0, LY_PREF_XML, "rpc-reply", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 0, LY_VALUE_XML, "rpc-reply", 0, 0, 0, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS,
"<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"55\"/>\n");
@@ -690,8 +690,8 @@
assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, op, in, LYD_XML, LYD_TYPE_REPLY_NETCONF, &tree, NULL));
ly_in_free(in, 0);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_PREF_XML, "rpc-reply", 0, 0, 0, 0, "");
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_PREF_XML, "ok", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_VALUE_XML, "rpc-reply", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 0, LY_VALUE_XML, "ok", 0, 0, 0, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS, data);
@@ -713,8 +713,8 @@
assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, op, in, LYD_XML, LYD_TYPE_REPLY_NETCONF, &tree, NULL));
ly_in_free(in, 0);
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_PREF_XML, "rpc-reply", 0, 0, 0, 0, "");
- CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 1, LY_PREF_XML, "rpc-error", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)tree, 1, 1, LY_VALUE_XML, "rpc-reply", 0, 0, 0, 0, "");
+ CHECK_LYD_NODE_OPAQ((struct lyd_node_opaq *)lyd_child(tree), 0, 1, LY_VALUE_XML, "rpc-error", 0, 0, 0, 0, "");
CHECK_LYD_STRING(tree, LYD_PRINT_WITHSIBLINGS, data);
diff --git a/tests/utests/data/test_tree_data.c b/tests/utests/data/test_tree_data.c
index f9ff619..43c99da 100644
--- a/tests/utests/data/test_tree_data.c
+++ b/tests/utests/data/test_tree_data.c
@@ -377,7 +377,7 @@
assert_int_equal(LY_SUCCESS, ly_path_parse(UTEST_LYCTX, NULL, path_str, strlen(path_str), LY_PATH_BEGIN_EITHER, LY_PATH_LREF_FALSE,
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_SIMPLE, &exp));
assert_int_equal(LY_SUCCESS, ly_path_compile(UTEST_LYCTX, NULL, NULL, NULL, exp, LY_PATH_LREF_FALSE, LY_PATH_OPER_INPUT,
- LY_PATH_TARGET_SINGLE, LY_PREF_JSON, NULL, NULL, &path));
+ LY_PATH_TARGET_SINGLE, LY_VALUE_JSON, NULL, NULL, &path));
term = lyd_target(path, tree);
const int unsigned flag = LYS_CONFIG_R | LYS_SET_ENUM | LYS_ORDBY_USER;
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index 3b5d784..a06445b 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -480,7 +480,7 @@
tree = tree->next;
TEST_PATTERN_1(tree, "ident", 1, IDENT, "types:gigabit-ethernet", "gigabit-ethernet");
leaf = (struct lyd_node_term *)tree;
- TEST_PRINTED_VALUE(&leaf->value, "t:gigabit-ethernet", LY_PREF_SCHEMA, mod_types->parsed);
+ TEST_PRINTED_VALUE(&leaf->value, "t:gigabit-ethernet", LY_VALUE_SCHEMA, mod_types->parsed);
lyd_free_all(tree);
CHECK_PARSE_LYD("<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</ident>", tree);
@@ -488,7 +488,7 @@
tree = tree->next;
TEST_PATTERN_1(tree, "ident", 1, IDENT, "defs:fast-ethernet", "fast-ethernet");
leaf = (struct lyd_node_term *)tree;
- TEST_PRINTED_VALUE(&leaf->value, "d:fast-ethernet", LY_PREF_SCHEMA, mod_defs->parsed);
+ TEST_PRINTED_VALUE(&leaf->value, "d:fast-ethernet", LY_VALUE_SCHEMA, mod_defs->parsed);
lyd_free_all(tree);
/* invalid value */
@@ -582,8 +582,8 @@
assert_int_equal(1, LY_ARRAY_COUNT(leaf->value.target[0].predicates));
assert_null(leaf->value.target[1].predicates);
- TEST_PRINTED_VALUE(&leaf->value, "/t:list_inst[t:id=\"/t:leaflisttarget[.='b']\"]/t:value", LY_PREF_SCHEMA, mod_types->parsed);
- TEST_PRINTED_VALUE(&leaf->value, "/types:list_inst[id=\"/types:leaflisttarget[.='b']\"]/value", LY_PREF_JSON, NULL);
+ TEST_PRINTED_VALUE(&leaf->value, "/t:list_inst[t:id=\"/t:leaflisttarget[.='b']\"]/t:value", LY_VALUE_SCHEMA, mod_types->parsed);
+ TEST_PRINTED_VALUE(&leaf->value, "/types:list_inst[id=\"/types:leaflisttarget[.='b']\"]/value", LY_VALUE_JSON, NULL);
lyd_free_all(tree);
data = "<list xmlns=\"urn:tests:types\"><id>a</id></list><list xmlns=\"urn:tests:types\"><id>b</id><value>x</value></list>"
@@ -980,7 +980,7 @@
TEST_PATTERN_1(tree, "un1", 0, UNION, "12", INT8, "12", 12);
leaf = (struct lyd_node_term *)tree;
assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 0);
- TEST_PRINTED_VALUE(&leaf->value, "12", LY_PREF_SCHEMA, NULL);
+ TEST_PRINTED_VALUE(&leaf->value, "12", LY_VALUE_SCHEMA, NULL);
lyd_free_all(tree);
data = "<int8 xmlns=\"urn:tests:types\">12</int8><un1 xmlns=\"urn:tests:types\">2</un1>";
@@ -989,7 +989,7 @@
TEST_PATTERN_1(tree, "un1", 0, UNION, "2", STRING, "2");
leaf = (struct lyd_node_term *)tree;
assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 0);
- TEST_PRINTED_VALUE(&leaf->value, "2", LY_PREF_SCHEMA, NULL);
+ TEST_PRINTED_VALUE(&leaf->value, "2", LY_VALUE_SCHEMA, NULL);
lyd_free_all(tree);
data = "<un1 xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</un1>";
@@ -998,8 +998,8 @@
TEST_PATTERN_1(tree, "un1", 0, UNION, "defs:fast-ethernet", IDENT, "defs:fast-ethernet", "fast-ethernet");
leaf = (struct lyd_node_term *)tree;
assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 1);
- TEST_PRINTED_VALUE(&leaf->value, "d:fast-ethernet", LY_PREF_SCHEMA, mod_defs->parsed);
- TEST_PRINTED_VALUE(&leaf->value.subvalue->value, "d:fast-ethernet", LY_PREF_SCHEMA, mod_defs->parsed);
+ TEST_PRINTED_VALUE(&leaf->value, "d:fast-ethernet", LY_VALUE_SCHEMA, mod_defs->parsed);
+ TEST_PRINTED_VALUE(&leaf->value.subvalue->value, "d:fast-ethernet", LY_VALUE_SCHEMA, mod_defs->parsed);
lyd_free_all(tree);
data = "<un1 xmlns=\"urn:tests:types\" xmlns:d=\"urn:tests:defs\">d:superfast-ethernet</un1>";
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index c283570..d492591 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -22,6 +22,7 @@
#include "in.h"
#include "parser_internal.h"
#include "schema_compile.h"
+#include "tree.h"
#include "tree_edit.h"
#include "tree_schema.h"
#include "tree_schema_internal.h"
@@ -122,7 +123,7 @@
#define ELEMENT_WRAPPER_END "</status>"
#define TEST_1_CHECK_LYSP_EXT_INSTANCE(NODE, INSUBSTMT)\
- CHECK_LYSP_EXT_INSTANCE((NODE), NULL, 1, INSUBSTMT, 0, "myext:c-define", LY_PREF_XML)
+ CHECK_LYSP_EXT_INSTANCE((NODE), NULL, 1, INSUBSTMT, 0, "myext:c-define", LY_VALUE_XML)
struct lys_yin_parser_ctx *YCTX;
@@ -336,7 +337,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, LY_STMT_CONTACT, 0, "myext:ext", LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, LY_STMT_CONTACT, 0, "myext:ext", LY_VALUE_XML);
CHECK_LYSP_STMT(exts->child, arg, 0, LYS_YIN_ATTR, 0, 1, stmt);
stmt = "value";
@@ -356,7 +357,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 0, LY_STMT_CONTACT, 0, "myext:extension-elem", LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 0, LY_STMT_CONTACT, 0, "myext:extension-elem", LY_VALUE_XML);
lysp_ext_instance_free(UTEST_LYCTX, exts);
LY_ARRAY_FREE(exts);
exts = NULL;
@@ -378,7 +379,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, LY_STMT_CONTACT, 0, "myext:ext", LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, LY_STMT_CONTACT, 0, "myext:ext", LY_VALUE_XML);
stmt = "attr1";
arg = "text1";
@@ -545,7 +546,7 @@
const char *exts_name = "myext:custom";
const char *exts_arg = "totally amazing extension";
- CHECK_LYSP_EXT_INSTANCE(exts, exts_arg, 0, LY_STMT_PREFIX, 0, exts_name, LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, exts_arg, 0, LY_STMT_PREFIX, 0, exts_name, LY_VALUE_XML);
assert_string_equal(value, "wsefsdf");
assert_string_equal(units, "radians");
assert_string_equal(when_p->cond, "condition...");
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index a8e6de4..3a95fa4 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -278,16 +278,16 @@
assert_non_null(ll->dflts);
assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference (typedef's default does not reference own type) */
assert_int_equal(2, LY_ARRAY_COUNT(ll->dflts));
- assert_string_equal("1", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("1", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
- assert_string_equal("1", dflt = ll->dflts[1]->realtype->plugin->print(ll->dflts[1], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("1", dflt = ll->dflts[1]->realtype->plugin->print(ll->dflts[1], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_USER | LYS_SET_DFLT | LYS_SET_CONFIG, ll->flags);
assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data->next));
assert_non_null(ll->dflts);
assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference */
assert_int_equal(1, LY_ARRAY_COUNT(ll->dflts));
- assert_string_equal("10", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("10", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR | LYS_ORDBY_USER, ll->flags);
@@ -1526,7 +1526,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, ly_resolve_prefix(UTEST_LYCTX, "a", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+ assert_ptr_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "a", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
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);
@@ -1547,7 +1547,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, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+ assert_ptr_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
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);
@@ -1561,7 +1561,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, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+ assert_ptr_not_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
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);
@@ -1570,7 +1570,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, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+ assert_ptr_not_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
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 */
@@ -1948,7 +1948,7 @@
assert_int_equal(3, type->refcount); /* 2x type reference, 1x default value's reference (typedf's default does not reference own type)*/
assert_int_equal(LY_TYPE_STRING, type->basetype);
assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("xxx", leaf->units);
@@ -1959,7 +1959,7 @@
assert_int_equal(3, type->refcount); /* 2x type reference, 1x default value's reference */
assert_int_equal(LY_TYPE_STRING, type->basetype);
leaf = (struct lysc_node_leaf *)mod->compiled->data;
- assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("yyy", leaf->units);
@@ -1971,7 +1971,7 @@
assert_int_equal(6, type->refcount); /* 4x type reference, 2x default value's reference (1 shared compiled type of typedefs which default does not reference own type) */
assert_int_equal(LY_TYPE_STRING, type->basetype);
leaf = (struct lysc_node_leaf *)mod->compiled->data;
- assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("yyy", leaf->units);
type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
@@ -1979,7 +1979,7 @@
assert_int_equal(6, type->refcount); /* 4x type reference, 2x default value's reference (1 shared compiled type of typedefs which default does not reference own type) */
assert_int_equal(LY_TYPE_STRING, type->basetype);
leaf = (struct lysc_node_leaf *)mod->compiled->data->next;
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("xxx", leaf->units);
@@ -1990,7 +1990,7 @@
assert_int_equal(4, type->refcount); /* 3x type reference, 1x default value's reference (typedef's default does not reference own type) */
assert_int_equal(LY_TYPE_STRING, type->basetype);
leaf = (struct lysc_node_leaf *)mod->compiled->data;
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("xxx", leaf->units);
@@ -2265,16 +2265,16 @@
assert_non_null((leaf = (struct lysc_node_leaf *)((struct lysc_node_container *)parent)->child));
assert_int_equal(LYS_LEAF, leaf->nodetype);
assert_string_equal("l", leaf->name);
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LYS_CONFIG_R, leaf->flags & LYS_CONFIG_MASK);
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_int_equal(LYS_LEAFLIST, llist->nodetype);
assert_string_equal("ll", llist->name);
assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
- assert_string_equal("world", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("world", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(5, llist->max);
assert_non_null(child = llist->next);
@@ -2287,7 +2287,7 @@
assert_int_equal(LYS_LEAF, leaf->nodetype);
assert_string_equal("x", leaf->name);
assert_false(LYS_MAND_TRUE & leaf->flags);
- assert_string_equal("cheers!", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("cheers!", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(leaf->musts);
assert_int_equal(2, LY_ARRAY_COUNT(leaf->musts));
@@ -2314,7 +2314,7 @@
assert_int_equal(LYS_LEAF, leaf->nodetype);
assert_string_equal("x", leaf->name);
assert_false(LYS_MAND_TRUE & leaf->flags);
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
/* invalid */
@@ -2647,15 +2647,15 @@
assert_null(leaf->dflt);
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(leaf = (struct lysc_node_leaf *)llist->next);
- assert_string_equal("nothing", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("nothing", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(5, leaf->dflt->realtype->refcount); /* 3x type reference, 2x default value reference (typedef's default does not reference own type) */
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("nothing", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("nothing", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module g {yang-version 1.1; namespace urn:g;prefix g;import e {prefix x;}"
@@ -2672,19 +2672,19 @@
assert_string_equal("ba", ((struct lysc_node_choice *)node)->dflt->name);
assert_non_null(leaf = (struct lysc_node_leaf *)node->next);
assert_non_null(leaf->dflt);
- assert_string_equal("bye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("bye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_int_equal(3, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
- assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
- assert_string_equal("people", llist->dflts[2]->realtype->plugin->print(llist->dflts[2], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("people", llist->dflts[2]->realtype->plugin->print(llist->dflts[2], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(leaf = (struct lysc_node_leaf *)llist->next);
assert_non_null(leaf->dflt);
- assert_string_equal("hi", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hi", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(6, leaf->dflt->realtype->refcount); /* 3x type reference, 3x default value reference
- previous type's default values were replaced by node's default values where d2 now has 2 default values */
@@ -2692,9 +2692,9 @@
assert_int_equal(0, LY_ARRAY_COUNT(leaf->musts[0].prefixes));
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("hi", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hi", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
- assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module h {yang-version 1.1; namespace urn:h;prefix h;import e {prefix x;}"
@@ -2708,7 +2708,7 @@
assert_string_equal("ba", ((struct lysc_node_choice *)node)->dflt->name);
assert_non_null(leaf = (struct lysc_node_leaf *)node->next);
assert_non_null(leaf->dflt);
- assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "module i {namespace urn:i;prefix i;"
@@ -2825,14 +2825,14 @@
assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
assert_string_equal("a", leaf->name);
assert_int_equal(LY_TYPE_INT8, leaf->type->basetype);
- assert_string_equal("10", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("10", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(10, leaf->dflt->uint8);
assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
assert_string_equal("b", llist->name);
assert_int_equal(LY_TYPE_INT8, llist->type->basetype);
assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
- assert_string_equal("1", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
+ assert_string_equal("1", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_VALUE_SCHEMA, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(1, llist->dflts[0]->uint8);
@@ -2873,7 +2873,7 @@
assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
assert_string_equal("s", leaf->name);
assert_non_null(leaf->dflt);
- assert_non_null(str = leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, mod->parsed, &dynamic));
+ assert_non_null(str = leaf->dflt->realtype->plugin->print(leaf->dflt, LY_VALUE_SCHEMA, mod->parsed, &dynamic));
assert_string_equal("/s:y", str);
if (dynamic) {
free((char *)str);
diff --git a/tests/utests/types/bits.c b/tests/utests/types/bits.c
index e674ea9..43eeac3 100644
--- a/tests/utests/types/bits.c
+++ b/tests/utests/types/bits.c
@@ -775,28 +775,28 @@
*/
val_text = "";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, BITS, "");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "zero one two";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, BITS, "zero one two", "zero", "one", "two");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "zero two";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, BITS, "zero two", "zero", "two");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "\n ";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, BITS, "");
assert_ptr_equal(value.realtype, lysc_type);
@@ -810,7 +810,7 @@
alloc = (char *)malloc(strlen(val_text) + 1);
memcpy(alloc, val_text, strlen(val_text) + 1);
ly_ret = type->store(UTEST_LYCTX, lysc_type, alloc, strlen(val_text),
- LYPLG_TYPE_STORE_DYNAMIC, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ LYPLG_TYPE_STORE_DYNAMIC, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
alloc = NULL;
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, BITS, "two", "two");
@@ -821,7 +821,7 @@
lysc_type_test.basetype = LY_TYPE_INT8;
val_text = "two";
ly_ret = type->store(UTEST_LYCTX, &lysc_type_test, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_EINVAL, ly_ret);
ly_err_free(err);
@@ -831,14 +831,14 @@
val_text = "two";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "two two";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
}
@@ -873,7 +873,7 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
@@ -894,7 +894,7 @@
diff_type_text = val_init[2];
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -906,7 +906,7 @@
diff_type_text = val_init[2];
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -918,7 +918,7 @@
diff_type_text = val_init[2];
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[2])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
@@ -953,19 +953,19 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
/* print value */
ly_bool dynamic = 0;
- assert_string_equal("", type->print(&(values[0]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("zero two", type->print(&(values[1]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("three", type->print(&(values[2]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("zero two", type->print(&(values[3]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("zero", type->print(&(values[4]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("three", type->print(&(values[5]), LY_PREF_XML, NULL, &dynamic));
+ assert_string_equal("", type->print(&(values[0]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("zero two", type->print(&(values[1]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("three", type->print(&(values[2]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("zero two", type->print(&(values[3]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("zero", type->print(&(values[4]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("three", type->print(&(values[5]), LY_VALUE_XML, NULL, &dynamic));
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
type->free(UTEST_LYCTX, &(values[it]));
@@ -995,7 +995,7 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
diff --git a/tests/utests/types/int8.c b/tests/utests/types/int8.c
index 0154d4f..05f2009 100644
--- a/tests/utests/types/int8.c
+++ b/tests/utests/types/int8.c
@@ -1401,21 +1401,21 @@
*/
val_text = "20";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, INT8, "20", 20);
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "-20";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, INT8, "-20", -20);
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "0xf";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "15", 15);
assert_ptr_equal(value.realtype, lysc_type);
@@ -1423,7 +1423,7 @@
val_text = "1B";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "27", 27);
assert_ptr_equal(value.realtype, lysc_type);
@@ -1431,7 +1431,7 @@
val_text = "-0xf";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "-15", -15);
assert_ptr_equal(value.realtype, lysc_type);
@@ -1439,7 +1439,7 @@
val_text = "027";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_OCTNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_OCTNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "23", 23);
assert_ptr_equal(value.realtype, lysc_type);
@@ -1447,7 +1447,7 @@
val_text = "-027";
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_OCTNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_OCTNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "-23", -23);
assert_ptr_equal(value.realtype, lysc_type);
@@ -1462,7 +1462,7 @@
memcpy(alloc, val_text, strlen(val_text) + 1);
ly_ret = type->store(UTEST_LYCTX, lysc_type, alloc, strlen(val_text),
- LYPLG_TYPE_STORE_DYNAMIC, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ LYPLG_TYPE_STORE_DYNAMIC, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
alloc = NULL;
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, INT8, "10", 10);
@@ -1473,7 +1473,7 @@
lysc_type_test.basetype = LY_TYPE_UINT8;
val_text = "20";
ly_ret = type->store(UTEST_LYCTX, &lysc_type_test, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EINT, ly_ret);
/*
@@ -1482,28 +1482,28 @@
val_text = "";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, 1,
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "10 b";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "a";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
}
@@ -1537,7 +1537,7 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
@@ -1557,7 +1557,7 @@
diff_type_text = "20";
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1569,7 +1569,7 @@
diff_type_text = "20";
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1581,7 +1581,7 @@
diff_type_text = "20";
diff_type = ((struct lysc_node_leaf *)mod->compiled->data->next->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1614,19 +1614,19 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
/* print value */
ly_bool dynamic = 0;
- assert_string_equal("32", type->print(&(values[0]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("74", type->print(&(values[1]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("-15", type->print(&(values[2]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("0", type->print(&(values[3]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("0", type->print(&(values[4]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("-32", type->print(&(values[5]), LY_PREF_XML, NULL, &dynamic));
+ assert_string_equal("32", type->print(&(values[0]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("74", type->print(&(values[1]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("-15", type->print(&(values[2]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("0", type->print(&(values[3]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("0", type->print(&(values[4]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("-32", type->print(&(values[5]), LY_VALUE_XML, NULL, &dynamic));
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
type->free(UTEST_LYCTX, &(values[it]));
@@ -1662,7 +1662,7 @@
/* CREATE VALUES */
for (unsigned int it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type[it % 2], val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_HEXNUM, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
diff --git a/tests/utests/types/string.c b/tests/utests/types/string.c
index 8007744..5ddb872 100644
--- a/tests/utests/types/string.c
+++ b/tests/utests/types/string.c
@@ -1059,35 +1059,35 @@
/* check store */
val_text = "20";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, STRING, "20");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "150\n";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, STRING, "150\n");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "<\"150>\n";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, STRING, "<\"150>\n");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "<\"150>\n|hi how are you";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, 8,
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, STRING, "<\"150>\n|");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
val_text = "";
assert_int_equal(LY_SUCCESS, type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err));
CHECK_LYD_VALUE(value, STRING, "");
assert_ptr_equal(value.realtype, lysc_type);
type->free(UTEST_LYCTX, &value);
@@ -1102,7 +1102,7 @@
memcpy(alloc_text, val_text, alloc_text_size + 1);
ly_ret = type->store(UTEST_LYCTX, lysc_type, alloc_text, alloc_text_size,
- LYPLG_TYPE_STORE_DYNAMIC, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ LYPLG_TYPE_STORE_DYNAMIC, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
alloc_text = NULL;
assert_int_equal(LY_SUCCESS, ly_ret);
CHECK_LYD_VALUE(value, STRING, "<250>");
@@ -1114,7 +1114,7 @@
lysc_type_test.basetype = LY_TYPE_UINT8;
val_text = "20";
ly_ret = type->store(UTEST_LYCTX, &lysc_type_test, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_EINVAL, ly_ret);
ly_err_free(err);
@@ -1123,21 +1123,21 @@
val_text = "10 \"| bcdei";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "012345678901";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
val_text = "10";
err = NULL;
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_text, strlen(val_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &value, NULL, &err);
assert_int_equal(LY_EVALID, ly_ret);
ly_err_free(err);
@@ -1173,7 +1173,7 @@
for (int unsigned it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
@@ -1189,7 +1189,7 @@
diff_type_text = "hi";
diff_type = ((struct lysc_node_leaf *) mod->compiled->data->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_SUCCESS, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1199,7 +1199,7 @@
diff_type_text = "hi";
diff_type = ((struct lysc_node_leaf *) mod->compiled->data->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1209,7 +1209,7 @@
diff_type_text = "20";
diff_type = ((struct lysc_node_leaf *) mod->compiled->data->next->next->next)->type;
ly_ret = diff_type->plugin->store(UTEST_LYCTX, diff_type, diff_type_text, strlen(diff_type_text),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_DECNUM, NULL, &diff_type_val, NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[0])));
assert_int_equal(LY_ENOT, type->compare(&diff_type_val, &(values[1])));
@@ -1242,17 +1242,17 @@
for (int unsigned it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type, val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}
/* print value */
ly_bool dynamic = 0;
- assert_string_equal("20", type->print(&(values[0]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("0x4A", type->print(&(values[1]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("<|>", type->print(&(values[2]), LY_PREF_XML, NULL, &dynamic));
- assert_string_equal("\"", type->print(&(values[3]), LY_PREF_XML, NULL, &dynamic));
+ assert_string_equal("20", type->print(&(values[0]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("0x4A", type->print(&(values[1]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("<|>", type->print(&(values[2]), LY_VALUE_XML, NULL, &dynamic));
+ assert_string_equal("\"", type->print(&(values[3]), LY_VALUE_XML, NULL, &dynamic));
for (int unsigned it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
type->free(UTEST_LYCTX, &(values[it]));
@@ -1289,7 +1289,7 @@
for (int unsigned it = 0; it < sizeof(val_init) / sizeof(val_init[0]); it++) {
ly_ret = type->store(UTEST_LYCTX, lysc_type[it % 2], val_init[it], strlen(val_init[it]),
- 0, LY_PREF_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
+ 0, LY_VALUE_XML, NULL, LYD_VALHINT_STRING, NULL, &(values[it]), NULL, &err);
assert_int_equal(LY_SUCCESS, ly_ret);
}