uncrustify FORMAT set various uncrustify options
PR #1228
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 18c76bc..15ae77c 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -25,8 +25,8 @@
#include "context.h"
#include "dict.h"
#include "log.h"
-#include "path.h"
#include "parser_schema.h"
+#include "path.h"
#include "set.h"
#include "tree.h"
#include "tree_schema.h"
@@ -149,7 +149,7 @@
/* get UTF8 code point (and number of bytes coding the character) */
LY_CHECK_ERR_RET(ly_getutf8(&in->current, &c, &len),
- LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, in->current[-len]), LY_EVALID);
+ LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, in->current[-len]), LY_EVALID);
in->current -= len;
if (c == '\n') {
ctx->indent = 0;
@@ -431,7 +431,7 @@
break;
default:
LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Double-quoted string unknown special character '\\%c'.",
- in->current[0]);
+ in->current[0]);
return LY_EVALID;
}
@@ -489,7 +489,7 @@
}
string_end:
- if (arg <= Y_PREF_IDENTIF_ARG && !(*word_len)) {
+ if ((arg <= Y_PREF_IDENTIF_ARG) && !(*word_len)) {
/* empty identifier */
LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Statement argument is required.");
return LY_EVALID;
@@ -517,6 +517,7 @@
{
size_t buf_len = 0;
uint8_t prefix = 0;
+
/* word buffer - dynamically allocated */
*word_b = NULL;
@@ -531,7 +532,7 @@
if (*word_len) {
/* invalid - quotes cannot be in unquoted string and only optsep, ; or { can follow it */
LOGVAL_PARSER(ctx, LY_VCODE_INSTREXP, 1, in->current,
- "unquoted string character, optsep, semicolon or opening brace");
+ "unquoted string character, optsep, semicolon or opening brace");
return LY_EVALID;
}
if (flags) {
@@ -595,7 +596,7 @@
case '}':
/* invalid - braces cannot be in unquoted string (opening braces terminates the string and can follow it) */
LOGVAL_PARSER(ctx, LY_VCODE_INSTREXP, 1, in->current,
- "unquoted string character, optsep, semicolon or opening brace");
+ "unquoted string character, optsep, semicolon or opening brace");
return LY_EVALID;
default:
LY_CHECK_RET(buf_store_char(ctx, in, arg, word_p, word_len, word_b, &buf_len, 0, &prefix));
@@ -685,7 +686,7 @@
word_start = in->current;
*kw = lysp_match_kw(ctx, in);
- if (*kw == LY_STMT_SYNTAX_SEMICOLON || *kw == LY_STMT_SYNTAX_LEFT_BRACE || *kw == LY_STMT_SYNTAX_RIGHT_BRACE) {
+ if ((*kw == LY_STMT_SYNTAX_SEMICOLON) || (*kw == LY_STMT_SYNTAX_LEFT_BRACE) || (*kw == LY_STMT_SYNTAX_RIGHT_BRACE)) {
goto success;
}
@@ -706,30 +707,30 @@
goto extension;
case '{':
/* allowed only for input and output statements which can be without arguments */
- if (*kw == LY_STMT_INPUT || *kw == LY_STMT_OUTPUT) {
+ if ((*kw == LY_STMT_INPUT) || (*kw == LY_STMT_OUTPUT)) {
break;
}
/* fallthrough */
default:
MOVE_INPUT(ctx, in, 1);
LOGVAL_PARSER(ctx, LY_VCODE_INSTREXP, (int)(in->current - word_start), word_start,
- "a keyword followed by a separator");
+ "a keyword followed by a separator");
return LY_EVALID;
}
} else {
/* still can be an extension */
prefix = 0;
extension:
- while (in->current[0] && (in->current[0] != ' ') && (in->current[0] != '\t') && (in->current[0] != '\n')
- && (in->current[0] != '{') && (in->current[0] != ';')) {
+ while (in->current[0] && (in->current[0] != ' ') && (in->current[0] != '\t') && (in->current[0] != '\n') &&
+ (in->current[0] != '{') && (in->current[0] != ';')) {
uint32_t c = 0;
LY_CHECK_ERR_RET(ly_getutf8(&in->current, &c, &len),
- LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, in->current[-len]), LY_EVALID);
+ LOGVAL_PARSER(ctx, LY_VCODE_INCHAR, in->current[-len]), LY_EVALID);
++ctx->indent;
/* check character validity */
LY_CHECK_RET(lysp_check_identifierchar((struct lys_parser_ctx *)ctx, c,
- in->current - len == word_start ? 1 : 0, &prefix));
+ in->current - len == word_start ? 1 : 0, &prefix));
}
if (!in->current[0]) {
LOGVAL_PARSER(ctx, LY_VCODE_EOF);
@@ -1679,7 +1680,7 @@
errno = 0;
if (val_kw == LY_STMT_VALUE) {
num = strtol(word, &ptr, 10);
- if (num < INT64_C(-2147483648) || num > INT64_C(2147483647)) {
+ if ((num < INT64_C(-2147483648)) || (num > INT64_C(2147483647))) {
LOGVAL_PARSER(ctx, LY_VCODE_INVAL, word_len, word, ly_stmt2str(val_kw));
goto error;
}
@@ -1771,12 +1772,12 @@
break;
case LY_STMT_VALUE:
LY_CHECK_ERR_RET(enum_kw == LY_STMT_BIT, LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw),
- ly_stmt2str(enum_kw)), LY_EVALID);
+ ly_stmt2str(enum_kw)), LY_EVALID);
LY_CHECK_RET(parse_type_enum_value_pos(ctx, in, kw, &enm->value, &enm->flags, &enm->exts));
break;
case LY_STMT_POSITION:
LY_CHECK_ERR_RET(enum_kw == LY_STMT_ENUM, LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw),
- ly_stmt2str(enum_kw)), LY_EVALID);
+ ly_stmt2str(enum_kw)), LY_EVALID);
LY_CHECK_RET(parse_type_enum_value_pos(ctx, in, kw, &enm->value, &enm->flags, &enm->exts));
break;
case LY_STMT_EXTENSION_INSTANCE:
@@ -2094,7 +2095,7 @@
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_PATH, 0, &str_path, Y_STR_ARG, &type->exts));
ret = ly_path_parse(ctx->ctx, NULL, str_path, 0, LY_PATH_BEGIN_EITHER, LY_PATH_LREF_TRUE,
- LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &type->path);
+ LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &type->path);
lydict_remove(ctx->ctx, str_path);
LY_CHECK_RET(ret);
type->flags |= LYS_SET_PATH;
@@ -4045,7 +4046,7 @@
LY_CHECK_RET(parse_status(ctx, in, &ident->flags, &ident->exts));
break;
case LY_STMT_BASE:
- if (ident->bases && ctx->mod_version < 2) {
+ if (ident->bases && (ctx->mod_version < 2)) {
LOGVAL_PARSER(ctx, LYVE_SYNTAX_YANG, "Identity can be derived from multiple base identities only in YANG 1.1 modules");
return LY_EVALID;
}
@@ -4461,7 +4462,7 @@
checks:
/* finalize parent pointers to the reallocated items */
LY_CHECK_RET(lysp_parse_finalize_reallocated((struct lys_parser_ctx *)ctx, submod->groupings, submod->augments,
- submod->rpcs, submod->notifs));
+ submod->rpcs, submod->notifs));
/* mandatory substatements */
if (!submod->prefix) {