uncrustify FEATURE control stmt spacing options
diff --git a/src/common.c b/src/common.c
index c6d3b6a..18db4f2 100644
--- a/src/common.c
+++ b/src/common.c
@@ -166,7 +166,7 @@
char *
ly_strnchr(const char *s, int c, unsigned int len)
{
- for (; *s != (char)c; ++s, --len) {
+ for ( ; *s != (char)c; ++s, --len) {
if ((*s == '\0') || (!len)) {
return NULL;
}
@@ -346,7 +346,7 @@
size_t len = 0;
const char *ptr = str;
- while(*ptr && (size_t)(ptr - str) < bytes) {
+ while (*ptr && (size_t)(ptr - str) < bytes) {
++len;
ptr += utf8_char_length_table[((unsigned char)(*ptr))];
}
@@ -583,7 +583,7 @@
*prefix_len = *id_len = *value_len = 0;
/* leading *WSP */
- for (; isspace(in[offset]); offset++) {}
+ for ( ; isspace(in[offset]); offset++) {}
if (isdigit(in[offset])) {
/* pos: "[" *WSP positive-integer-value *WSP "]" */
@@ -595,7 +595,7 @@
/* positive-integer-value */
*value = &in[offset++];
- for (; isdigit(in[offset]); offset++) {}
+ for ( ; isdigit(in[offset]); offset++) {}
*value_len = &in[offset] - *value;
} else if (in[offset] == '.') {
@@ -627,7 +627,7 @@
if (expr) {
/* *WSP "=" *WSP quoted-string *WSP "]" */
- for (; isspace(in[offset]); offset++) {}
+ for ( ; isspace(in[offset]); offset++) {}
if (in[offset] != '=') {
if (expr == 1) {
@@ -638,7 +638,7 @@
goto error;
}
offset++;
- for (; isspace(in[offset]); offset++) {}
+ for ( ; isspace(in[offset]); offset++) {}
/* quoted-string */
quot = in[offset++];
@@ -647,7 +647,7 @@
goto error;
}
*value = &in[offset];
- for (; offset < limit && (in[offset] != quot || (offset && in[offset - 1] == '\\')); offset++) {}
+ for ( ; offset < limit && (in[offset] != quot || (offset && in[offset - 1] == '\\')); offset++) {}
if (in[offset] == quot) {
*value_len = &in[offset] - *value;
offset++;
@@ -658,7 +658,7 @@
}
/* *WSP "]" */
- for(; isspace(in[offset]); offset++) {}
+ for ( ; isspace(in[offset]); offset++) {}
if (in[offset] != ']') {
if (expr == 0) {
*errmsg = "Predicate (pos) is not terminated by \']\' character.";
diff --git a/src/context.c b/src/context.c
index 8de2f82..5ffca2c 100644
--- a/src/context.c
+++ b/src/context.c
@@ -309,7 +309,7 @@
API void
ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data)
{
- LY_CHECK_ARG_RET(ctx, ctx,);
+ LY_CHECK_ARG_RET(ctx, ctx, );
ctx->imp_clb = clb;
ctx->imp_clb_data = user_data;
@@ -357,7 +357,7 @@
struct lys_module *mod;
const char *value;
- for (; *index < ctx->list.count; ++(*index)) {
+ for ( ; *index < ctx->list.count; ++(*index)) {
mod = ctx->list.objs[*index];
value = *(const char**)(((int8_t*)(mod)) + key_offset);
if ((!key_size && !strcmp(key, value)) || (key_size && !strncmp(key, value, key_size) && value[key_size] == '\0')) {
@@ -835,7 +835,7 @@
}
/* models list */
- for (; ctx->list.count; ctx->list.count--) {
+ for ( ; ctx->list.count; ctx->list.count--) {
/* remove the module */
lys_module_free(ctx->list.objs[ctx->list.count - 1], private_destructor);
}
diff --git a/src/diff.c b/src/diff.c
index e0b0b7b..e20c520 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -201,7 +201,7 @@
} else {
for (iter = first; iter->prev->next; iter = iter->prev) {}
}
- for (; iter; iter = iter->next) {
+ for ( ; iter; iter = iter->next) {
if (iter->schema == first->schema) {
LY_ARRAY_NEW_RET(schema->module->ctx, item->inst, node, NULL);
*node = iter;
@@ -353,7 +353,7 @@
if (*op == LYD_DIFF_OP_CREATE) {
/* insert the instance */
LY_ARRAY_RESIZE_ERR_RET(schema->module->ctx, userord_item->inst, LY_ARRAY_COUNT(userord_item->inst) + 1,
- ;, LY_EMEM);
+ ; , LY_EMEM);
if (second_pos < LY_ARRAY_COUNT(userord_item->inst)) {
memmove(userord_item->inst + second_pos + 1, userord_item->inst + second_pos,
(LY_ARRAY_COUNT(userord_item->inst) - second_pos) * sizeof *userord_item->inst);
diff --git a/src/hash_table.c b/src/hash_table.c
index 5506ca8..3c749ea 100644
--- a/src/hash_table.c
+++ b/src/hash_table.c
@@ -45,7 +45,7 @@
void
lydict_init(struct dict_table *dict)
{
- LY_CHECK_ARG_RET(NULL, dict,);
+ LY_CHECK_ARG_RET(NULL, dict, );
dict->hash_tab = lyht_new(1024, sizeof(struct dict_rec), lydict_val_eq, NULL, 1);
LY_CHECK_ERR_RET(!dict->hash_tab, LOGINT(NULL), );
@@ -59,7 +59,7 @@
struct dict_rec *dict_rec = NULL;
struct ht_rec *rec = NULL;
- LY_CHECK_ARG_RET(NULL, dict,);
+ LY_CHECK_ARG_RET(NULL, dict, );
for (i = 0; i < dict->hash_tab->size; i++) {
/* get ith record */
diff --git a/src/json.c b/src/json.c
index c13fab7..fd3c946 100644
--- a/src/json.c
+++ b/src/json.c
@@ -432,7 +432,7 @@
if (dp_position <= 0) {
num[i++] = '0';
num[i++] = '.';
- for (; dp_position; dp_position++) {
+ for ( ; dp_position; dp_position++) {
num[i++] = '0';
}
}
diff --git a/src/parser_stmt.c b/src/parser_stmt.c
index 7f282a6..05a8997 100644
--- a/src/parser_stmt.c
+++ b/src/parser_stmt.c
@@ -799,7 +799,7 @@
pctx.pos_type = LY_VLOG_STR;
pctx.path = ctx->path;
- switch(kw) {
+ switch (kw) {
case LY_STMT_STATUS: {
ret = lysp_stmt_status((struct lys_parser_ctx *)&pctx, stmt, *(uint16_t**)result, exts);
break;
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 3a0b339..c09700b 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -364,7 +364,7 @@
assert(need_buf);
current_indent += 8;
ctx->indent += 8;
- for (; current_indent > block_indent; --current_indent, --ctx->indent) {
+ for ( ; current_indent > block_indent; --current_indent, --ctx->indent) {
/* store leftover spaces from the tab */
c = in->current;
in->current = " ";
@@ -839,7 +839,7 @@
INSERT_WORD(ctx, buf, e->argument, word, word_len);
}
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
LY_CHECK_RET(parse_ext_substmt(ctx, in, kw, word, word_len, &e->child));
}
return ret;
@@ -879,7 +879,7 @@
/* store value and spend buf if allocated */
INSERT_WORD(ctx, buf, *value, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, substmt, substmt_index, exts));
@@ -929,7 +929,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_VERSION, 0, exts));
@@ -1030,7 +1030,7 @@
strncpy(rev, word, word_len);
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_REVISIONDATE, 0, exts));
@@ -1076,7 +1076,7 @@
return LY_EVALID;
}
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
PARSER_CHECK_STMTVER2_RET(ctx, "description", "include");
@@ -1190,7 +1190,7 @@
strncpy(rev->date, word, word_len);
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &rev->dsc, Y_STR_ARG, &rev->exts));
@@ -1238,7 +1238,7 @@
LY_CHECK_RET(get_argument(ctx, in, arg, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, *item, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, substmt, LY_ARRAY_COUNT(*texts) - 1, exts));
@@ -1288,7 +1288,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_CONFIG, 0, exts));
@@ -1338,7 +1338,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_MANDATORY, 0, exts));
@@ -1374,7 +1374,7 @@
CHECK_NONEMPTY(ctx, word_len, ly_stmt2str(restr_kw));
INSERT_WORD(ctx, buf, restr->arg, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &restr->dsc, Y_STR_ARG, &restr->exts));
@@ -1457,7 +1457,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_STATUS, 0, exts));
@@ -1503,7 +1503,7 @@
*when_p = when;
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &when->dsc, Y_STR_ARG, &when->exts));
@@ -1551,7 +1551,7 @@
INSERT_WORD(ctx, buf, any->name, word, word_len);
/* parse substatements */
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_CONFIG:
LY_CHECK_RET(parse_config(ctx, in, &any->flags, &any->exts));
@@ -1656,7 +1656,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, val_kw == LY_STMT_VALUE ? LYEXT_SUBSTMT_VALUE : LYEXT_SUBSTMT_POSITION, 0, exts));
@@ -1704,7 +1704,7 @@
INSERT_WORD(ctx, buf, enm->name, word, word_len);
CHECK_UNIQUENESS(ctx, *enums, name, ly_stmt2str(enum_kw), enm->name);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &enm->dsc, Y_STR_ARG, &enm->exts));
@@ -1789,7 +1789,7 @@
*fracdig = num;
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_FRACDIGITS, 0, exts));
@@ -1840,7 +1840,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_REQINSTANCE, 0, exts));
@@ -1897,7 +1897,7 @@
buf[0] = 0x15;
*pat = lydict_insert_zc(ctx->ctx, buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_MODIFIER, 0, exts));
@@ -1946,7 +1946,7 @@
buf[word_len + 1] = '\0'; /* terminating NULL byte */
restr->arg = lydict_insert_zc(ctx->ctx, buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &restr->dsc, Y_STR_ARG, &restr->exts));
@@ -2003,7 +2003,7 @@
LY_CHECK_RET(get_argument(ctx, in, Y_PREF_IDENTIF_ARG, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, type->name, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_BASE:
LY_CHECK_RET(parse_text_fields(ctx, in, LYEXT_SUBSTMT_BASE, &type->bases, Y_PREF_IDENTIF_ARG, &type->exts));
@@ -2221,7 +2221,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_MAX, 0, exts));
@@ -2286,7 +2286,7 @@
*min = num;
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_MIN, 0, exts));
@@ -2336,7 +2336,7 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_ORDEREDBY, 0, exts));
@@ -2473,7 +2473,7 @@
CHECK_NONEMPTY(ctx, word_len, "refine");
INSERT_WORD(ctx, buf, rf->nodeid, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_CONFIG:
LY_CHECK_RET(parse_config(ctx, in, &rf->flags, &rf->exts));
@@ -3119,7 +3119,7 @@
INSERT_WORD(ctx, buf, cas->name, word, word_len);
/* parse substatements */
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &cas->dsc, Y_STR_ARG, &cas->exts));
@@ -3543,11 +3543,12 @@
}
free(buf);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_EXTENSION_INSTANCE:
LY_CHECK_RET(parse_ext(ctx, in, word, word_len, LYEXT_SUBSTMT_YINELEM, 0, exts));
- LY_CHECK_RET(ret); break;
+ LY_CHECK_RET(ret);
+ break;
default:
LOGVAL_PARSER(ctx, LY_VCODE_INCHILDSTMT, ly_stmt2str(kw), "yin-element");
return LY_EVALID;
@@ -3584,7 +3585,7 @@
LY_CHECK_RET(get_argument(ctx, in, Y_IDENTIF_ARG, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, *argument, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_YIN_ELEMENT:
LY_CHECK_RET(parse_yinelement(ctx, in, flags, exts));
@@ -3624,7 +3625,7 @@
LY_CHECK_RET(get_argument(ctx, in, Y_IDENTIF_ARG, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, ex->name, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &ex->dsc, Y_STR_ARG, &ex->exts));
@@ -3737,7 +3738,7 @@
/* insert into siblings */
LY_LIST_INSERT(deviates, d, next);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_CONFIG:
switch (dev_mod) {
@@ -3936,7 +3937,7 @@
LY_CHECK_RET(get_argument(ctx, in, Y_IDENTIF_ARG, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, feat->name, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &feat->dsc, Y_STR_ARG, &feat->exts));
@@ -3985,7 +3986,7 @@
LY_CHECK_RET(get_argument(ctx, in, Y_IDENTIF_ARG, NULL, &word, &buf, &word_len));
INSERT_WORD(ctx, buf, ident->name, word, word_len);
- YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret,) {
+ YANG_READ_SUBSTMT_FOR(ctx, in, kw, word, word_len, ret, ) {
switch (kw) {
case LY_STMT_DESCRIPTION:
LY_CHECK_RET(parse_text_field(ctx, in, LYEXT_SUBSTMT_DESCRIPTION, 0, &ident->dsc, Y_STR_ARG, &ident->exts));
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 5ec0bb4..33a3e3c 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -196,7 +196,7 @@
static void
subelems_deallocator(size_t count, struct yin_subelement *subelems)
{
- for(size_t i = 0; i < count; ++i) {
+ for (size_t i = 0; i < count; ++i) {
if (HAS_META(subelems[i].type)) {
free(subelems[i].dest);
}
@@ -1039,7 +1039,7 @@
*(struct lysp_type **)subinfo->dest = calloc(1, sizeof **(struct lysp_type **)subinfo->dest);
LY_CHECK_ERR_RET(!(*(struct lysp_type **)subinfo->dest), LOGMEM(ctx->xmlctx->ctx), LY_EMEM);
type = *((struct lysp_type **)subinfo->dest);
- } else {
+ } else {
type = (struct lysp_type *)subinfo->dest;
}
/* type as child of another type */
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index 90e4de4..94c97cd 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -54,7 +54,7 @@
API const char *
lyext_parent2str(LYEXT_PARENT type)
{
- switch(type) {
+ switch (type) {
case LYEXT_PAR_MODULE:
return "module";
case LYEXT_PAR_NODE:
diff --git a/src/plugins_types.c b/src/plugins_types.c
index e2fad91..dd8cf5a 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -216,14 +216,14 @@
LY_CHECK_ARG_RET(NULL, err, datatype, LY_EINVAL);
/* consume leading whitespaces */
- for (; value_len && isspace(*value); ++value, --value_len) {}
+ for ( ; value_len && isspace(*value); ++value, --value_len) {}
if (!value || !value[0] || !value_len) {
rc = asprintf(&errmsg, "Invalid empty %s value.", datatype);
goto error;
}
- switch(ly_parse_int(value, value_len, min, max, base, ret)) {
+ switch (ly_parse_int(value, value_len, min, max, base, ret)) {
case LY_EDENIED:
rc = asprintf(&errmsg, "Value is out of %s's min/max bounds.", datatype);
goto error;
@@ -254,7 +254,7 @@
LY_CHECK_ARG_RET(NULL, err, datatype, LY_EINVAL);
/* consume leading whitespaces */
- for (; value_len && isspace(*value); ++value, --value_len) {}
+ for ( ; value_len && isspace(*value); ++value, --value_len) {}
if (!value || !value[0] || !value_len) {
rc = asprintf(&errmsg, "Invalid empty %s value.", datatype);
@@ -293,7 +293,7 @@
int64_t d;
/* consume leading whitespaces */
- for (; value_len && isspace(*value); ++value, --value_len) {}
+ for ( ; value_len && isspace(*value); ++value, --value_len) {}
/* parse value */
if (!value_len) {
@@ -649,14 +649,14 @@
if (d) {
int count = sprintf(buf, "%" PRId64 " ", d);
if ((d > 0 && (count - 1) <= type_dec->fraction_digits)
- || (count - 2) <= type_dec->fraction_digits ) {
+ || (count - 2) <= type_dec->fraction_digits) {
/* we have 0. value, print the value with the leading zeros
* (one for 0. and also keep the correct with of num according
* to fraction-digits value)
* for (num<0) - extra character for '-' sign */
count = sprintf(buf, "%0*" PRId64 " ", (d > 0) ? (type_dec->fraction_digits + 1) : (type_dec->fraction_digits + 2), d);
}
- for (int i = type_dec->fraction_digits, j = 1; i > 0 ; i--) {
+ for (int i = type_dec->fraction_digits, j = 1; i > 0; i--) {
if (j && i > 1 && buf[count - 2] == '0') {
/* we have trailing zero to skip */
buf[count - 1] = '\0';
@@ -1196,7 +1196,7 @@
static LY_ERR
ly_type_store_identityref(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
LY_PREFIX_FORMAT format, void *prefix_data, const void *UNUSED(context_node),
- const struct lyd_node *UNUSED(tree),struct lyd_value *storage, struct ly_err_item **err)
+ const struct lyd_node *UNUSED(tree), struct lyd_value *storage, struct ly_err_item **err)
{
struct lysc_type_identityref *type_ident = (struct lysc_type_identityref *)type;
const char *id_name, *prefix = value;
diff --git a/src/printer.c b/src/printer.c
index 099060b..1f74076 100644
--- a/src/printer.c
+++ b/src/printer.c
@@ -341,7 +341,7 @@
{
LY_CHECK_ARG_RET(NULL, out, LY_EINVAL);
- switch(out->type) {
+ switch (out->type) {
case LY_OUT_ERROR:
LOGINT(NULL);
return LY_EINT;
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 12dc0a8..e5c1a3c 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -862,7 +862,7 @@
/* written hash was a collision, write also all the preceding hashes */
for (i = 0; !(hash & (LYB_HASH_COLLISION_ID >> i)); ++i) {}
- for (; i; --i) {
+ for ( ; i; --i) {
hash = lyb_hash(schema, i - 1);
if (!hash) {
return LY_EINT;
diff --git a/src/printer_yin.c b/src/printer_yin.c
index 24c354e..ddc7cc2 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -1274,8 +1274,8 @@
the extension instance substatements in extension instances (LY_STMT_EXTENSION_INSTANCE)
cannot find the compiled information, so it is needed to be done,
currently it is ignored */
- if(stmt_attr_info[stmt->kw].name) {
- if(stmt_attr_info[stmt->kw].flags & SUBST_FLAG_YIN) {
+ if (stmt_attr_info[stmt->kw].name) {
+ if (stmt_attr_info[stmt->kw].flags & SUBST_FLAG_YIN) {
ypr_open(ctx, stmt->stmt, NULL, NULL, flag);
ypr_yin_arg(ctx, stmt_attr_info[stmt->kw].arg, stmt->arg);
} else {
diff --git a/src/tree_data.c b/src/tree_data.c
index 7f2efa2..ad484fc 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -283,7 +283,7 @@
size_t len = strlen(path);
/* ignore trailing whitespaces */
- for (; len > 0 && isspace(path[len - 1]); len--) {}
+ for ( ; len > 0 && isspace(path[len - 1]); len--) {}
if (len >= 5 && !strncmp(&path[len - 4], ".xml", 4)) {
format = LYD_XML;
@@ -1284,7 +1284,7 @@
}
/* create all the non-existing nodes in a loop */
- for (; path_idx < LY_ARRAY_COUNT(p); ++path_idx) {
+ for ( ; path_idx < LY_ARRAY_COUNT(p); ++path_idx) {
cur_parent = node;
schema = p[path_idx].node;
@@ -1700,7 +1700,7 @@
if (sibling->parent) {
sibling = sibling->parent->child;
} else {
- for (; sibling->prev->next != node; sibling = sibling->prev) {}
+ for ( ; sibling->prev->next != node; sibling = sibling->prev) {}
}
sibling->prev = node;
}
@@ -1779,7 +1779,7 @@
par->child = node;
node->parent = par;
- for (; par; par = par->parent) {
+ for ( ; par; par = par->parent) {
if ((par->flags & LYD_DEFAULT) && !(node->flags & LYD_DEFAULT)) {
/* remove default flags from NP containers */
par->flags &= ~LYD_DEFAULT;
@@ -2379,7 +2379,7 @@
return LY_SUCCESS;
}
- for (; iter1 && iter2; iter1 = iter1->next, iter2 = iter2->next) {
+ for ( ; iter1 && iter2; iter1 = iter1->next, iter2 = iter2->next) {
if (lyd_compare_single(iter1, iter2, options | LYD_COMPARE_FULL_RECURSION)) {
return LY_ENOT;
}
@@ -2429,7 +2429,7 @@
API LY_ERR
lyd_compare_siblings(const struct lyd_node *node1, const struct lyd_node *node2, int options)
{
- for (; node1 && node2; node1 = node1->next, node2 = node2->next) {
+ for ( ; node1 && node2; node1 = node1->next, node2 = node2->next) {
LY_CHECK_RET(lyd_compare_single(node1, node2, options));
}
@@ -2685,7 +2685,7 @@
}
/* rehash if needed */
- for (; local_parent; local_parent = local_parent->parent) {
+ for ( ; local_parent; local_parent = local_parent->parent) {
if (local_parent->schema->nodetype == LYS_LIST && (local_parent->schema->flags & LYS_KEYLESS)) {
lyd_hash((struct lyd_node *)local_parent);
}
@@ -3171,7 +3171,7 @@
}
} else {
/* no children hash table */
- for (; siblings; siblings = siblings->next) {
+ for ( ; siblings; siblings = siblings->next) {
if (!lyd_compare_single(siblings, target, 0)) {
break;
}
@@ -3249,7 +3249,7 @@
}
/* search manually without hashes */
- for (; siblings; siblings = siblings->next) {
+ for ( ; siblings; siblings = siblings->next) {
if (siblings->schema == schema) {
/* schema match is enough */
break;
diff --git a/src/tree_data_free.c b/src/tree_data_free.c
index 305cb69..388271b 100644
--- a/src/tree_data_free.c
+++ b/src/tree_data_free.c
@@ -232,7 +232,7 @@
/* get the first (top-level) sibling */
if (top) {
- for (; node->parent; node = (struct lyd_node *)node->parent) {}
+ for ( ; node->parent; node = (struct lyd_node *)node->parent) {}
}
while (node->prev->next) {
node = node->prev;
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 9b32314..3b7d8b2 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -202,7 +202,7 @@
LY_CHECK_ARG_RET(ctx, qpath, NULL);
- while(*id) {
+ while (*id) {
if (id[0] == '/') {
++id;
}
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 686d634..3f880dd 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -243,7 +243,7 @@
if (!name) {
/* removing last path segment */
if (ctx->path[ctx->path_len - 1] == '}') {
- for (; ctx->path[ctx->path_len] != '=' && ctx->path[ctx->path_len] != '{'; --ctx->path_len) {}
+ for ( ; ctx->path[ctx->path_len] != '=' && ctx->path[ctx->path_len] != '{'; --ctx->path_len) {}
if (ctx->path[ctx->path_len] == '=') {
ctx->path[ctx->path_len++] = '}';
} else {
@@ -252,7 +252,7 @@
}
} else {
remove_nodelevel:
- for (; ctx->path[ctx->path_len] != '/' ; --ctx->path_len) {}
+ for ( ; ctx->path[ctx->path_len] != '/'; --ctx->path_len) {}
if (ctx->path_len == 0) {
/* top-level (last segment) */
ctx->path_len = 1;
@@ -721,7 +721,7 @@
if (!strncmp(&c[i], "not", r = 3) || !strncmp(&c[i], "and", r = 3) || !strncmp(&c[i], "or", r = 2)) {
int sp;
- for(sp = 0; c[i + r + sp] && isspace(c[i + r + sp]); sp++);
+ for (sp = 0; c[i + r + sp] && isspace(c[i + r + sp]); sp++);
if (c[i + r + sp] == '\0') {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
"Invalid value \"%s\" of if-feature - unexpected end of expression.", *value);
@@ -803,7 +803,7 @@
continue;
} else if (c[i] == '(') {
/* pop from the stack into result all operators until ) */
- while((op = iff_stack_pop(&stack)) != LYS_IFF_RP) {
+ while ((op = iff_stack_pop(&stack)) != LYS_IFF_RP) {
iff_setop(iff->expr, op, expr_size--);
}
continue;
@@ -1701,7 +1701,7 @@
assert(range_p);
expr = range_p->arg;
- while(1) {
+ while (1) {
if (isspace(*expr)) {
++expr;
} else if (*expr == '\0') {
@@ -2842,7 +2842,7 @@
if (un_aux->types[v]->basetype == LY_TYPE_LEAFREF) {
/* duplicate the whole structure because of the instance-specific path resolving for realtype */
un->types[u + additional] = calloc(1, sizeof(struct lysc_type_leafref));
- LY_CHECK_ERR_RET(!un->types[u + additional], LOGMEM(ctx->ctx);lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux), LY_EMEM);
+ LY_CHECK_ERR_RET(!un->types[u + additional], LOGMEM(ctx->ctx); lysc_type_free(ctx->ctx, (struct lysc_type*)un_aux), LY_EMEM);
lref = (struct lysc_type_leafref *)un->types[u + additional];
lref->basetype = LY_TYPE_LEAFREF;
@@ -4244,12 +4244,12 @@
struct lysc_node *iter;
if (add) { /* set flag */
- for (; parent && parent->nodetype == LYS_CONTAINER && !(parent->flags & LYS_MAND_TRUE) && !(parent->flags & LYS_PRESENCE);
+ for ( ; parent && parent->nodetype == LYS_CONTAINER && !(parent->flags & LYS_MAND_TRUE) && !(parent->flags & LYS_PRESENCE);
parent = parent->parent) {
parent->flags |= LYS_MAND_TRUE;
}
} else { /* unset flag */
- for (; parent && parent->nodetype == LYS_CONTAINER && (parent->flags & LYS_MAND_TRUE); parent = parent->parent) {
+ for ( ; parent && parent->nodetype == LYS_CONTAINER && (parent->flags & LYS_MAND_TRUE); parent = parent->parent) {
for (iter = (struct lysc_node*)lysc_node_children(parent, 0); iter; iter = iter->next) {
if (iter->flags & LYS_MAND_TRUE) {
/* there is another mandatory node */
@@ -6002,13 +6002,13 @@
if (prefix) {
/* use module prefixes from the deviation module to match the module of the default case */
if (!(mod = lys_module_find_prefix(ctx->mod, prefix, prefix_len))) {
- LOGVAL(ctx->ctx,LY_VLOG_STR,ctx->path,LYVE_REFERENCE,
+ LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Invalid deviation deleting \"default\" property \"%s\" of choice. "
"The prefix does not match any imported module of the deviation module.", d->dflts[0]);
goto cleanup;
}
if (mod != ((struct lysc_node_choice*)target)->dflt->module) {
- LOGVAL(ctx->ctx,LY_VLOG_STR,ctx->path,LYVE_REFERENCE,
+ LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_REFERENCE,
"Invalid deviation deleting \"default\" property \"%s\" of choice. "
"The prefix does not match the default case's module.", d->dflts[0]);
goto cleanup;
@@ -6742,7 +6742,7 @@
memset(&tmp_set, 0, sizeof tmp_set);
/* prepare in_ctx of the set */
- for ( i = 0; i < set->used; ++i) {
+ for (i = 0; i < set->used; ++i) {
xp_scnode = &set->val.scnodes[i];
if (xp_scnode->in_ctx != -1) {
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 0ab7de9..940a9a5 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -276,7 +276,7 @@
struct lysp_deviate_rpl *rpl = (struct lysp_deviate_rpl*)d;
FREE_ARRAY(ctx, d->exts, lysp_ext_instance_free);
- switch(d->mod) {
+ switch (d->mod) {
case LYS_DEV_NOT_SUPPORTED:
/* nothing to do */
break;
@@ -338,7 +338,7 @@
FREE_STRINGS(ctx, node->iffeatures);
FREE_ARRAY(ctx, node->exts, lysp_ext_instance_free);
- switch(node->nodetype) {
+ switch (node->nodetype) {
case LYS_CONTAINER:
FREE_ARRAY(ctx, ((struct lysp_node_container*)node)->musts, lysp_restr_free);
FREE_STRING(ctx, ((struct lysp_node_container*)node)->presence);
@@ -599,7 +599,7 @@
return;
}
- switch(type->basetype) {
+ switch (type->basetype) {
case LY_TYPE_BINARY:
FREE_MEMBER(ctx, ((struct lysc_type_bin*)type)->length, lysc_range_free);
break;
@@ -784,7 +784,7 @@
FREE_STRING(ctx, node->ref);
/* nodetype-specific part */
- switch(node->nodetype) {
+ switch (node->nodetype) {
case LYS_CONTAINER:
lysc_node_container_free(ctx, (struct lysc_node_container*)node);
break;
@@ -823,7 +823,7 @@
struct ly_ctx *ctx;
struct lysc_node *node, *node_next;
- LY_CHECK_ARG_RET(NULL, module,);
+ LY_CHECK_ARG_RET(NULL, module, );
ctx = module->mod->ctx;
FREE_ARRAY(ctx, module->features, lysc_feature_free);
@@ -885,7 +885,7 @@
continue;
}
- switch(substmts[u].stmt) {
+ switch (substmts[u].stmt) {
case LY_STMT_TYPE:
if (substmts[u].cardinality < LY_STMT_CARD_SOME) {
/* single item */
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index bcb8821..3e43227 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1075,7 +1075,7 @@
API const char *
lys_nodetype2str(uint16_t nodetype)
{
- switch(nodetype) {
+ switch (nodetype) {
case LYS_CONTAINER:
return "container";
case LYS_CHOICE:
@@ -1108,7 +1108,7 @@
const char *
lys_datatype2str(LY_DATA_TYPE basetype)
{
- switch(basetype) {
+ switch (basetype) {
case LY_TYPE_BINARY:
return "binary";
case LY_TYPE_UINT8:
@@ -1632,7 +1632,7 @@
{
LY_CHECK_ARG_RET(NULL, ext, LY_EINVAL);
- for (; index < LY_ARRAY_COUNT(ext); index++) {
+ for ( ; index < LY_ARRAY_COUNT(ext); index++) {
if (ext[index].insubstmt == substmt) {
return index;
}
diff --git a/src/validation.c b/src/validation.c
index 7a7046a..3bf851d 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -226,7 +226,7 @@
fail = 1;
}
} else {
- for (; first; first = first->next) {
+ for ( ; first; first = first->next) {
if (first == node) {
continue;
}
diff --git a/src/xml.c b/src/xml.c
index b46d015..933fa52 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -33,7 +33,7 @@
#include "tree_data.h"
/* Move input p by s characters, if EOF log with lyxml_ctx c */
-#define move_input(c,s) ly_in_skip(c->in, s); LY_CHECK_ERR_RET(!c->in->current[0], LOGVAL(c->ctx, LY_VLOG_LINE, &c->line, LY_VCODE_EOF), LY_EVALID)
+#define move_input(c, s) ly_in_skip(c->in, s); LY_CHECK_ERR_RET(!c->in->current[0], LOGVAL(c->ctx, LY_VLOG_LINE, &c->line, LY_VCODE_EOF), LY_EVALID)
/* Ignore whitespaces in the input string p */
#define ign_xmlws(c) while (is_xmlws(*(c)->in->current)) {if (*(c)->in->current == '\n') {++c->line;} ly_in_skip(c->in, 1);}
diff --git a/src/xpath.c b/src/xpath.c
index 0f5c744..4072aab 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -995,7 +995,7 @@
orig_used = set->used;
set->used = 0;
- for (i = 0; i < orig_used;) {
+ for (i = 0; i < orig_used; ) {
start = -1;
do {
if ((set->val.nodes[i].type != LYXP_NODE_NONE) && (start == -1)) {
@@ -1595,7 +1595,7 @@
/* find first top-level node to be used as anchor for positions */
for (root = set->ctx_node; root->parent; root = (const struct lyd_node *)root->parent) {}
- for (; root->prev->next; root = root->prev) {}
+ for ( ; root->prev->next; root = root->prev) {}
/* fill positions */
if (set_assign_pos(set, root, set->root_type)) {
@@ -1715,7 +1715,7 @@
/* find first top-level node to be used as anchor for positions */
for (root = trg->ctx_node; root->parent; root = (const struct lyd_node *)root->parent) {}
- for (; root->prev->next; root = root->prev) {}
+ for ( ; root->prev->next; root = root->prev) {}
/* fill positions */
if (set_assign_pos(trg, root, trg->root_type) || set_assign_pos(src, root, src->root_type)) {
@@ -2774,7 +2774,7 @@
for (tok_len = 0; isdigit(expr[parsed + tok_len]); ++tok_len) {}
if (expr[parsed + tok_len] == '.') {
++tok_len;
- for (; isdigit(expr[parsed + tok_len]); ++tok_len) {}
+ for ( ; isdigit(expr[parsed + tok_len]); ++tok_len) {}
}
tok_type = LYXP_TOKEN_NUMBER;
@@ -2789,7 +2789,7 @@
tok_type = LYXP_TOKEN_OPER_PATH;
}
- } else if (!strncmp(&expr[parsed], "!=", 2)) {
+ } else if (!strncmp(&expr[parsed], "!=", 2)) {
/* Operator '!=' */
tok_len = 2;
@@ -4009,7 +4009,7 @@
}
/* find lang metadata */
- for (; node; node = (struct lyd_node *)node->parent) {
+ for ( ; node; node = (struct lyd_node *)node->parent) {
for (meta = node->meta; meta; meta = meta->next) {
/* annotations */
if (meta->name && !strcmp(meta->name, "lang") && !strcmp(meta->annotation->module->name, "xml")) {
@@ -5070,7 +5070,7 @@
return LY_EVALID;
}
- for (i = 0; i < set->used;) {
+ for (i = 0; i < set->used; ) {
switch (set->val.nodes[i].type) {
case LYXP_NODE_NONE:
LOGINT_RET(set->ctx);
@@ -8289,7 +8289,7 @@
}
op = ctx_node ? ctx_node->schema : NULL;
- for (; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = op->parent) {}
+ for ( ; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = op->parent) {}
if (!ctx_node || (!op && (ctx_node->schema->flags & LYS_CONFIG_W))) {
/* root context node can access only config data (because we said so, it is unspecified) */