Skip to content

Commit a4f3e9a

Browse files
committed
Merge branch 'devel'
2 parents 0ade103 + e730327 commit a4f3e9a

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(CMAKE_MACOSX_RPATH TRUE)
1111
# set version
1212
set(LIBYANG_MAJOR_VERSION 0)
1313
set(LIBYANG_MINOR_VERSION 13)
14-
set(LIBYANG_MICRO_VERSION 58)
14+
set(LIBYANG_MICRO_VERSION 59)
1515
set(LIBYANG_VERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION}.${LIBYANG_MICRO_VERSION})
1616
set(LIBYANG_SOVERSION ${LIBYANG_MAJOR_VERSION}.${LIBYANG_MINOR_VERSION})
1717
configure_file(${PROJECT_SOURCE_DIR}/src/libyang.h.in ${PROJECT_SOURCE_DIR}/src/libyang.h)

src/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ typedef enum {
224224
LYE_NOLEAFREF,
225225
LYE_NOMANDCHOICE,
226226

227+
LYE_XPATH_INSNODE,
227228
LYE_XPATH_INTOK,
228229
LYE_XPATH_EOF,
229230
LYE_XPATH_INOP_1,

src/libyang.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,7 @@ typedef enum {
17231723
LYVE_NOLEAFREF, /**< leaf pointed to by leafref does not exist (data) */
17241724
LYVE_NOMANDCHOICE, /**< no mandatory choice case branch exists (data) */
17251725

1726+
LYVE_XPATH_INSNODE,/**< schema node not found */
17261727
LYVE_XPATH_INTOK, /**< unexpected XPath token */
17271728
LYVE_XPATH_EOF, /**< unexpected end of an XPath expression */
17281729
LYVE_XPATH_INOP, /**< invalid XPath operation operands */

src/log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ const char *ly_errs[] = {
302302
/* LYE_NOLEAFREF */ "Leafref \"%s\" of value \"%s\" points to a non-existing leaf.",
303303
/* LYE_NOMANDCHOICE */ "Mandatory choice \"%s\" missing a case branch.",
304304

305+
/* LYE_XPATH_INSNODE */"Schema node \"%.*s\" not found (%.*s) with context node \"%s\".",
305306
/* LYE_XPATH_INTOK */ "Unexpected XPath token %s (%.15s).",
306307
/* LYE_XPATH_EOF */ "Unexpected XPath expression end.",
307308
/* LYE_XPATH_INOP_1 */ "Cannot apply XPath operation %s on %s.",
@@ -396,6 +397,7 @@ static const LY_VECODE ecode2vecode[] = {
396397
LYVE_NOLEAFREF, /* LYE_NOLEAFREF */
397398
LYVE_NOMANDCHOICE, /* LYE_NOMANDCHOICE */
398399

400+
LYVE_XPATH_INSNODE,/* LYE_XPATH_INSNODE */
399401
LYVE_XPATH_INTOK, /* LYE_XPATH_INTOK */
400402
LYVE_XPATH_EOF, /* LYE_XPATH_EOF */
401403
LYVE_XPATH_INOP, /* LYE_XPATH_INOP_1 */

src/xpath.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6374,7 +6374,7 @@ eval_node_test(struct lyxp_expr *exp, uint16_t *exp_idx, struct lyd_node *cur_no
63746374
exp->tok_len[*exp_idx], options);
63756375
}
63766376
} else {
6377-
if (set && (options & LYXP_SNODE_ALL)) {
6377+
if (set && (set->type == LYXP_SET_SNODE_SET)) {
63786378
rc = moveto_snode(set, (struct lys_node *)cur_node, &exp->expr[exp->expr_pos[*exp_idx]],
63796379
exp->tok_len[*exp_idx], options);
63806380
} else {
@@ -6390,11 +6390,20 @@ eval_node_test(struct lyxp_expr *exp, uint16_t *exp_idx, struct lyd_node *cur_no
63906390
}
63916391
}
63926392
if (i == -1) {
6393-
path = lys_path((struct lys_node *)cur_node);
6394-
LOGWRN("Schema node \"%.*s\" not found (%.*s) with context node \"%s\".",
6395-
exp->tok_len[*exp_idx], &exp->expr[exp->expr_pos[*exp_idx]],
6396-
exp->expr_pos[*exp_idx] + exp->tok_len[*exp_idx], exp->expr, path);
6397-
free(path);
6393+
if (options & LYXP_SNODE_ALL) {
6394+
path = lys_path((struct lys_node *)cur_node);
6395+
LOGWRN("Schema node \"%.*s\" not found (%.*s) with context node \"%s\".",
6396+
exp->tok_len[*exp_idx], &exp->expr[exp->expr_pos[*exp_idx]],
6397+
exp->expr_pos[*exp_idx] + exp->tok_len[*exp_idx], exp->expr, path);
6398+
free(path);
6399+
} else {
6400+
path = lyd_path(cur_node);
6401+
LOGVAL(LYE_XPATH_INSNODE, LY_VLOG_NONE, NULL,
6402+
exp->tok_len[*exp_idx], &exp->expr[exp->expr_pos[*exp_idx]],
6403+
exp->expr_pos[*exp_idx] + exp->tok_len[*exp_idx], exp->expr, path);
6404+
free(path);
6405+
return -1;
6406+
}
63986407
}
63996408
}
64006409
}

0 commit comments

Comments
 (0)