libyang REFACTOR avoid constant literals
Improve readability of the code.
Includes also unification of "no break in the case" comment to "fall
through".
diff --git a/src/path.c b/src/path.c
index e565dfe..f51bee7 100644
--- a/src/path.c
+++ b/src/path.c
@@ -170,7 +170,8 @@
/* FuncName */
LY_CHECK_GOTO(lyxp_check_token(ctx, exp, *tok_idx, LYXP_TOKEN_FUNCNAME), token_error);
- if ((exp->tok_len[*tok_idx] != 7) || strncmp(exp->expr + exp->tok_pos[*tok_idx], "current", 7)) {
+ if ((exp->tok_len[*tok_idx] != ly_strlen_const("current")) ||
+ strncmp(exp->expr + exp->tok_pos[*tok_idx], "current", ly_strlen_const("current"))) {
LOGVAL_P(ctx, cur_node, LYVE_XPATH, "Invalid function \"%.*s\" invocation in path.",
exp->tok_len[*tok_idx], exp->expr + exp->tok_pos[*tok_idx]);
goto token_error;
@@ -582,7 +583,7 @@
LY_ARRAY_NEW_RET(ctx, *predicates, p, LY_EMEM);
/* syntax was already checked */
- p->position = strtoull(expr->expr + expr->tok_pos[*tok_idx], (char **)&name, 10);
+ p->position = strtoull(expr->expr + expr->tok_pos[*tok_idx], (char **)&name, LY_BASE_DEC);
++(*tok_idx);
/* ']' */