Merging upstream version 3.12.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
6375ddbe5b
commit
580fa3f55c
66 changed files with 4041 additions and 2142 deletions
47
src/xpath.c
47
src/xpath.c
|
@ -3690,6 +3690,7 @@ xpath_bit_is_set(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp
|
|||
struct lyd_node_term *leaf;
|
||||
struct lysc_node_leaf *sleaf;
|
||||
struct lyd_value_bits *bits;
|
||||
struct lyd_value *val;
|
||||
LY_ERR rc = LY_SUCCESS;
|
||||
LY_ARRAY_COUNT_TYPE u;
|
||||
|
||||
|
@ -3725,10 +3726,14 @@ xpath_bit_is_set(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp
|
|||
LY_CHECK_RET(rc);
|
||||
|
||||
set_fill_boolean(set, 0);
|
||||
if (args[0]->used) {
|
||||
if (args[0]->used && (args[0]->val.nodes[0].node->schema->nodetype & LYD_NODE_TERM)) {
|
||||
leaf = (struct lyd_node_term *)args[0]->val.nodes[0].node;
|
||||
if ((leaf->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST)) && (leaf->value.realtype->basetype == LY_TYPE_BITS)) {
|
||||
LYD_VALUE_GET(&leaf->value, bits);
|
||||
val = &leaf->value;
|
||||
if (val->realtype->basetype == LY_TYPE_UNION) {
|
||||
val = &val->subvalue->value;
|
||||
}
|
||||
if (val->realtype->basetype == LY_TYPE_BITS) {
|
||||
LYD_VALUE_GET(val, bits);
|
||||
LY_ARRAY_FOR(bits->items, u) {
|
||||
if (!strcmp(bits->items[u]->name, args[1]->val.str)) {
|
||||
set_fill_boolean(set, 1);
|
||||
|
@ -4200,17 +4205,21 @@ xpath_derived_(struct lyxp_set **args, struct lyxp_set *set, uint32_t options, l
|
|||
leaf = (struct lyd_node_term *)args[0]->val.nodes[i].node;
|
||||
sleaf = (struct lysc_node_leaf *)leaf->schema;
|
||||
val = &leaf->value;
|
||||
if (!sleaf || !(sleaf->nodetype & LYD_NODE_TERM) || (leaf->value.realtype->basetype != LY_TYPE_IDENT)) {
|
||||
if (!sleaf || !(sleaf->nodetype & LYD_NODE_TERM)) {
|
||||
/* uninteresting */
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
meta = args[0]->val.meta[i].meta;
|
||||
val = &meta->value;
|
||||
if (val->realtype->basetype != LY_TYPE_IDENT) {
|
||||
/* uninteresting */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (val->realtype->basetype == LY_TYPE_UNION) {
|
||||
val = &val->subvalue->value;
|
||||
}
|
||||
if (val->realtype->basetype != LY_TYPE_IDENT) {
|
||||
/* uninteresting */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* check the identity itself */
|
||||
|
@ -4972,6 +4981,7 @@ xpath_re_match(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp_s
|
|||
LOG_LOCBACK(0, 1);
|
||||
}
|
||||
if (rc != LY_SUCCESS) {
|
||||
free(*pattern);
|
||||
LY_ARRAY_FREE(patterns);
|
||||
return rc;
|
||||
}
|
||||
|
@ -6801,7 +6811,8 @@ moveto_scnode(struct lyxp_set *set, const struct lys_module *moveto_mod, const c
|
|||
}
|
||||
}
|
||||
|
||||
if (moveto_mod && ncname && ((axis == LYXP_AXIS_DESCENDANT) || (axis == LYXP_AXIS_CHILD)) &&
|
||||
/* only consider extension nodes after no local ones were found */
|
||||
if ((orig_used == set->used) && moveto_mod && ncname && ((axis == LYXP_AXIS_DESCENDANT) || (axis == LYXP_AXIS_CHILD)) &&
|
||||
(set->val.scnodes[i].type == LYXP_NODE_ELEM) && !ly_nested_ext_schema(NULL, set->val.scnodes[i].scnode,
|
||||
moveto_mod->name, strlen(moveto_mod->name), LY_VALUE_JSON, NULL, ncname, strlen(ncname), &iter, NULL)) {
|
||||
/* there is a matching node from an extension, use it */
|
||||
|
@ -8236,14 +8247,16 @@ moveto:
|
|||
}
|
||||
LY_CHECK_GOTO(rc, cleanup);
|
||||
|
||||
i = set->used;
|
||||
do {
|
||||
--i;
|
||||
if (set->val.scnodes[i].in_ctx > LYXP_SET_SCNODE_ATOM_NODE) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
} while (i);
|
||||
if (set->used) {
|
||||
i = set->used;
|
||||
do {
|
||||
--i;
|
||||
if (set->val.scnodes[i].in_ctx > LYXP_SET_SCNODE_ATOM_NODE) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
} while (i);
|
||||
}
|
||||
if (!found) {
|
||||
/* generate message */
|
||||
eval_name_test_scnode_no_match_msg(set, scparent, ncname, ncname_len, exp->expr, options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue