uncrustify FORMAT set various uncrustify options
PR #1228
diff --git a/src/parser_json.c b/src/parser_json.c
index 9d0b801..5d36915 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -207,7 +207,7 @@
}
} else {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, parent, LYVE_SYNTAX_JSON, "Top-level JSON object member \"%.*s\" must be namespace-qualified.",
- is_attr ? name_len + 1 : name_len, is_attr ? name - 1 : name);
+ is_attr ? name_len + 1 : name_len, is_attr ? name - 1 : name);
return LY_EVALID;
}
if (!mod) {
@@ -231,7 +231,7 @@
if (!*snode_p) {
if (lydctx->parse_options & LYD_PARSE_STRICT) {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, parent, LYVE_REFERENCE, "Node \"%.*s\" not found in the \"%s\" module.",
- name_len, name, mod->name);
+ name_len, name, mod->name);
return LY_EVALID;
} else if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
/* skip element with children */
@@ -454,7 +454,7 @@
*type_hint_p = LYD_VALHINT_STRING | LYD_VALHINT_NUM64;
} else if (*status_p == LYJSON_NUMBER) {
*type_hint_p = LYD_VALHINT_DECNUM;
- } else if (*status_p == LYJSON_FALSE || *status_p == LYJSON_TRUE) {
+ } else if ((*status_p == LYJSON_FALSE) || (*status_p == LYJSON_TRUE)) {
*type_hint_p = LYD_VALHINT_BOOLEAN;
} else if (*status_p == LYJSON_NULL) {
*type_hint_p = 0;
@@ -561,7 +561,7 @@
size_t name_len, prefix_len;
const struct lysc_node *snode;
- if (attr->schema || meta_container->name[0] != '@') {
+ if (attr->schema || (meta_container->name[0] != '@')) {
/* not an opaq metadata node */
continue;
}
@@ -585,7 +585,7 @@
if (((struct lyd_node_opaq *)node)->hints & LYD_NODEHINT_LIST) {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, node, LYVE_SYNTAX,
- "Metadata container references a sibling list node %s.", ((struct lyd_node_opaq *)node)->name);
+ "Metadata container references a sibling list node %s.", ((struct lyd_node_opaq *)node)->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -641,13 +641,13 @@
mod = ly_ctx_get_module_implemented(lydctx->jsonctx->ctx, meta->prefix.id);
if (mod) {
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, node, NULL, mod,
- meta->name, strlen(meta->name), meta->value, ly_strlen(meta->value),
- &dynamic, LY_PREF_JSON, NULL, meta->hints);
+ meta->name, strlen(meta->name), meta->value, ly_strlen(meta->value),
+ &dynamic, LY_PREF_JSON, NULL, meta->hints);
LY_CHECK_GOTO(ret, cleanup);
} else if (lydctx->parse_options & LYD_PARSE_STRICT) {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, node, LYVE_REFERENCE,
- "Unknown (or not implemented) YANG module \"%s\" for metadata \"%s%s%s\".",
- meta->prefix.id, meta->prefix.id, ly_strlen(meta->prefix.id) ? ":" : "", meta->name);
+ "Unknown (or not implemented) YANG module \"%s\" for metadata \"%s%s%s\".",
+ meta->prefix.id, meta->prefix.id, ly_strlen(meta->prefix.id) ? ":" : "", meta->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -664,11 +664,11 @@
/* there is no corresponding data node for the metadata */
if (instance > 1) {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, *first_p ? (*first_p)->parent : NULL, LYVE_REFERENCE,
- "Missing %d%s JSON data instance to be coupled with %s metadata.", instance,
- instance == 2 ? "nd" : (instance == 3 ? "rd" : "th"), meta_container->name);
+ "Missing %d%s JSON data instance to be coupled with %s metadata.", instance,
+ instance == 2 ? "nd" : (instance == 3 ? "rd" : "th"), meta_container->name);
} else {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, *first_p ? (*first_p)->parent : NULL, LYVE_REFERENCE,
- "Missing JSON data instance to be coupled with %s metadata.", meta_container->name);
+ "Missing JSON data instance to be coupled with %s metadata.", meta_container->name);
}
ret = LY_EVALID;
} else {
@@ -743,10 +743,10 @@
}
LY_CHECK_GOTO(status != LYJSON_OBJECT && status != LYJSON_NULL, representation_error);
- if (!node || node->schema != prev->schema) {
+ if (!node || (node->schema != prev->schema)) {
LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, prev->parent, LYVE_REFERENCE,
- "Missing JSON data instance no. %u of %s:%s to be coupled with metadata.",
- instance, prev->schema->module->name, prev->schema->name);
+ "Missing JSON data instance no. %u of %s:%s to be coupled with metadata.",
+ instance, prev->schema->module->name, prev->schema->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -785,14 +785,14 @@
lydjson_parse_name(lydctx->jsonctx->value, lydctx->jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
if (!prefix) {
LOGVAL(ctx, LY_VLOG_LYD, (void *)node, LYVE_SYNTAX_JSON,
- "Metadata in JSON must be namespace-qualified, missing prefix for \"%.*s\".",
- lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+ "Metadata in JSON must be namespace-qualified, missing prefix for \"%.*s\".",
+ lydctx->jsonctx->value_len, lydctx->jsonctx->value);
ret = LY_EVALID;
goto cleanup;
} else if (is_attr) {
LOGVAL(ctx, LY_VLOG_LYD, (void *)node, LYVE_SYNTAX_JSON,
- "Invalid format of the Metadata identifier in JSON, unexpected '@' in \"%.*s\"",
- lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+ "Invalid format of the Metadata identifier in JSON, unexpected '@' in \"%.*s\"",
+ lydctx->jsonctx->value_len, lydctx->jsonctx->value);
ret = LY_EVALID;
goto cleanup;
}
@@ -802,8 +802,8 @@
if (!mod) {
if (lydctx->parse_options & LYD_PARSE_STRICT) {
LOGVAL(ctx, LY_VLOG_LYD, (void *)node, LYVE_REFERENCE,
- "Prefix \"%.*s\" of the metadata \"%.*s\" does not match any module in the context.",
- prefix_len, prefix, name_len, name);
+ "Prefix \"%.*s\" of the metadata \"%.*s\" does not match any module in the context.",
+ prefix_len, prefix, name_len, name);
ret = LY_EVALID;
goto cleanup;
}
@@ -825,8 +825,8 @@
/* create metadata */
meta = NULL;
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, node, &meta, mod, name, name_len, lydctx->jsonctx->value,
- lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
- LYD_HINT_DATA);
+ lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
+ LYD_HINT_DATA);
LY_CHECK_GOTO(ret, cleanup);
/* add/correct flags */
@@ -844,7 +844,7 @@
/* attr2 is always changed to the created attribute */
ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, name, name_len, lydctx->jsonctx->value, lydctx->jsonctx->value_len,
- &lydctx->jsonctx->dynamic, LYD_JSON, 0, val_prefs, prefix, prefix_len, module_name, module_name_len);
+ &lydctx->jsonctx->dynamic, LYD_JSON, 0, val_prefs, prefix, prefix_len, module_name, module_name_len);
LY_CHECK_GOTO(ret, cleanup);
}
/* next member */
@@ -869,9 +869,9 @@
representation_error:
LOGVAL(ctx, LY_VLOG_LYD, (void *)node, LYVE_SYNTAX_JSON,
- "The attribute(s) of %s \"%s\" is expected to be represented as JSON %s, but input data contains @%s/%s.",
- lys_nodetype2str(nodetype), node->schema ? node->schema->name : ((struct lyd_node_opaq *)node)->name,
- expected, lyjson_token2str(status), in_parent ? "" : "name");
+ "The attribute(s) of %s \"%s\" is expected to be represented as JSON %s, but input data contains @%s/%s.",
+ lys_nodetype2str(nodetype), node->schema ? node->schema->name : ((struct lyd_node_opaq *)node)->name,
+ expected, lyjson_token2str(status), in_parent ? "" : "name");
return LY_EVALID;
}
@@ -936,7 +936,7 @@
ly_bool dynamic = 0;
uint32_t type_hint = 0;
- if (*status_inner_p != LYJSON_OBJECT && *status_inner_p != LYJSON_OBJECT_EMPTY) {
+ if ((*status_inner_p != LYJSON_OBJECT) && (*status_inner_p != LYJSON_OBJECT_EMPTY)) {
/* prepare for creating opaq node with a value */
value = lydctx->jsonctx->value;
value_len = lydctx->jsonctx->value_len;
@@ -960,18 +960,18 @@
}
LY_CHECK_RET(ret);
- if (*status_p == LYJSON_OBJECT || *status_p == LYJSON_OBJECT_EMPTY) {
+ if ((*status_p == LYJSON_OBJECT) || (*status_p == LYJSON_OBJECT_EMPTY)) {
/* process children */
while (*status_p != LYJSON_OBJECT_CLOSED && *status_p != LYJSON_OBJECT_EMPTY) {
LY_CHECK_RET(lydjson_subtree_r(lydctx, (struct lyd_node_inner *)(*node_p), lyd_node_children_p(*node_p)));
*status_p = lyjson_ctx_status(lydctx->jsonctx, 0);
}
- } else if (*status_p == LYJSON_ARRAY || *status_p == LYJSON_ARRAY_EMPTY) {
+ } else if ((*status_p == LYJSON_ARRAY) || (*status_p == LYJSON_ARRAY_EMPTY)) {
/* process another instance of the same node */
/* but first mark the node to be expected a list or a leaf-list */
((struct lyd_node_opaq *)*node_p)->hints |= LYD_NODEHINT_LIST | LYD_NODEHINT_LEAFLIST;
- if (*status_inner_p == LYJSON_OBJECT || *status_inner_p == LYJSON_OBJECT_EMPTY) {
+ if ((*status_inner_p == LYJSON_OBJECT) || (*status_inner_p == LYJSON_OBJECT_EMPTY)) {
/* but first process children of the object in the array */
while (*status_inner_p != LYJSON_OBJECT_CLOSED && *status_inner_p != LYJSON_OBJECT_EMPTY) {
LY_CHECK_RET(lydjson_subtree_r(lydctx, (struct lyd_node_inner *)(*node_p), lyd_node_children_p(*node_p)));
@@ -1056,7 +1056,7 @@
lydctx->parse_options |= LYD_PARSE_OPAQ;
ret = lydjson_parse_opaq(lydctx, prefix ? prefix - 1 : name - 1, prefix ? prefix_len + name_len + 2 : name_len + 1,
- NULL, 0, parent, status_p, status_inner == LYJSON_ERROR ? status_p : &status_inner, first_p, node_p);
+ NULL, 0, parent, status_p, status_inner == LYJSON_ERROR ? status_p : &status_inner, first_p, node_p);
/* restore the parser options */
lydctx->parse_options = prev_opts;
@@ -1101,8 +1101,8 @@
if (snode->nodetype & LYD_NODE_TERM) {
/* create terminal node */
ret = lyd_parser_create_term((struct lyd_ctx *)lydctx, snode, lydctx->jsonctx->value,
- lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
- type_hints, node);
+ lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_PREF_JSON, NULL,
+ type_hints, node);
LY_CHECK_RET(ret);
/* move JSON parser */
@@ -1139,8 +1139,8 @@
/* add any missing default children */
ret = lyd_new_implicit_r(*node, lyd_node_children_p(*node), NULL, NULL, &lydctx->unres_node_type,
- &lydctx->when_check, (lydctx->validate_options & LYD_VALIDATE_NO_STATE)
- ? LYD_IMPLICIT_NO_STATE : 0, NULL);
+ &lydctx->when_check, (lydctx->validate_options & LYD_VALIDATE_NO_STATE) ?
+ LYD_IMPLICIT_NO_STATE : 0, NULL);
LY_CHECK_RET(ret);
}
@@ -1177,7 +1177,7 @@
} else if (ret == LY_ENOT) {
/* parse it again as an opaq node */
ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent,
- status, status, first_p, node);
+ status, status, first_p, node);
LY_CHECK_RET(ret);
if (snode->nodetype == LYS_LIST) {
@@ -1243,7 +1243,7 @@
/* parent's metadata without a name - use the schema from the parent */
if (!parent) {
LOGVAL(ctx, LY_VLOG_LYD, NULL, LYVE_SYNTAX_JSON,
- "Invalid metadata format - \"@\" can be used only inside anydata, container or list entries.");
+ "Invalid metadata format - \"@\" can be used only inside anydata, container or list entries.");
ret = LY_EVALID;
goto cleanup;
}
@@ -1251,7 +1251,7 @@
snode = attr_node->schema;
}
ret = lydjson_parse_attribute(lydctx, attr_node, snode, name, name_len, prefix, prefix_len, parent, &status,
- first_p, &node);
+ first_p, &node);
LY_CHECK_GOTO(ret, cleanup);
} else if (!snode) {
/* parse as an opaq node */
@@ -1271,7 +1271,7 @@
}
ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len,
- parent, &status, status_inner == LYJSON_ERROR ? &status : &status_inner, first_p, &node);
+ parent, &status, status_inner == LYJSON_ERROR ? &status : &status_inner, first_p, &node);
LY_CHECK_GOTO(ret, cleanup);
} else {
/* parse as a standard lyd_node but it can still turn out to be an opaque node */
@@ -1301,7 +1301,7 @@
lydjson_maintain_children(parent, first_p, &node);
ret = lydjson_parse_instance(lydctx, parent, first_p, snode, name, name_len, prefix, prefix_len,
- &status, &node);
+ &status, &node);
if (ret == LY_EINVAL) {
goto representation_error;
} else if (ret) {
@@ -1357,8 +1357,8 @@
representation_error:
LOGVAL(ctx, LY_VLOG_LYD, parent, LYVE_SYNTAX_JSON,
- "The %s \"%s\" is expected to be represented as JSON %s, but input data contains name/%s.",
- lys_nodetype2str(snode->nodetype), snode->name, expected, lyjson_token2str(status));
+ "The %s \"%s\" is expected to be represented as JSON %s, but input data contains name/%s.",
+ lys_nodetype2str(snode->nodetype), snode->name, expected, lyjson_token2str(status));
ret = LY_EVALID;
goto cleanup;
@@ -1438,8 +1438,8 @@
cleanup:
/* there should be no unresolved types stored */
- assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count
- && !lydctx->when_check.count));
+ assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count &&
+ !lydctx->when_check.count));
if (ret) {
lyd_json_ctx_free((struct lyd_ctx *)lydctx);
@@ -1508,11 +1508,11 @@
/* create notification envelope */
ret = lyd_create_opaq(jsonctx->ctx, "notification", 12, "", 0, NULL, LYD_JSON, LYD_NODEHINT_ENVELOPE, NULL, NULL,
- 0, "ietf-restconf", 13, envp_p);
+ 0, "ietf-restconf", 13, envp_p);
LY_CHECK_GOTO(ret, cleanup);
/* create notification envelope */
ret = lyd_create_opaq(jsonctx->ctx, "eventTime", 9, value, value_len, &dynamic, LYD_JSON, LYD_VALHINT_STRING, NULL,
- NULL, 0, "ietf-restconf", 13, &et);
+ NULL, 0, "ietf-restconf", 13, &et);
LY_CHECK_GOTO(ret, cleanup);
/* insert eventTime into notification */
lyd_insert_node(*envp_p, NULL, et);
@@ -1567,9 +1567,9 @@
LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
ret = LY_EVALID;
goto cleanup;
- } else if (lydctx->jsonctx->in->current[0] && lyjson_ctx_status(lydctx->jsonctx, 0) != LYJSON_OBJECT_CLOSED) {
+ } else if (lydctx->jsonctx->in->current[0] && (lyjson_ctx_status(lydctx->jsonctx, 0) != LYJSON_OBJECT_CLOSED)) {
LOGVAL(ctx, LY_VLOG_LINE, &lydctx->jsonctx->line, LYVE_SYNTAX, "Unexpected sibling element of \"%s\".",
- tree->schema->name);
+ tree->schema->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -1584,7 +1584,7 @@
goto cleanup;
} else if (status != LYJSON_OBJECT_CLOSED) {
LOGVAL(ctx, LY_VLOG_LINE, &lydctx->jsonctx->line, LYVE_SYNTAX, "Unexpected sibling member \"%.*s\" of \"notification\".",
- lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+ lydctx->jsonctx->value_len, lydctx->jsonctx->value);
ret = LY_EVALID;
goto cleanup;
}
@@ -1652,7 +1652,7 @@
/* create the object envelope */
ret = lyd_create_opaq(jsonctx->ctx, object_id, strlen(object_id), "", 0, NULL, LYD_JSON, LYD_NODEHINT_ENVELOPE,
- NULL, NULL, 0, module_key, ly_strlen(module_key), envp_p);
+ NULL, NULL, 0, module_key, ly_strlen(module_key), envp_p);
LY_CHECK_GOTO(ret, cleanup);
if (parent) {
@@ -1675,7 +1675,7 @@
return LY_EVALID;
} else if (status != LYJSON_OBJECT_CLOSED) {
LOGVAL(jsonctx->ctx, LY_VLOG_LINE, &jsonctx->line, LYVE_SYNTAX, "Unexpected sibling member \"%.*s\" of \"%s\".",
- jsonctx->value_len, jsonctx->value, object_id);
+ jsonctx->value_len, jsonctx->value, object_id);
return LY_EVALID;
}
return LY_SUCCESS;
@@ -1730,12 +1730,12 @@
/* make sure we have parsed some operation */
if (!lydctx->op_node) {
LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the %s node.",
- act_e ? "action" : (rpc_e ? "rpc" : "rpc/action"));
+ act_e ? "action" : (rpc_e ? "rpc" : "rpc/action"));
ret = LY_EVALID;
goto cleanup;
- } else if (lydctx->jsonctx->in->current[0] && lyjson_ctx_status(lydctx->jsonctx, 0) != LYJSON_OBJECT_CLOSED) {
+ } else if (lydctx->jsonctx->in->current[0] && (lyjson_ctx_status(lydctx->jsonctx, 0) != LYJSON_OBJECT_CLOSED)) {
LOGVAL(ctx, LY_VLOG_LINE, &lydctx->jsonctx->line, LYVE_SYNTAX, "Unexpected sibling element of \"%s\".",
- tree->schema->name);
+ tree->schema->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -1746,7 +1746,7 @@
LY_CHECK_GOTO(ret, cleanup);
if (lydctx->op_node->schema->nodetype != LYS_ACTION) {
LOGVAL(ctx, LY_VLOG_LYD, lydctx->op_node, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
- lys_nodetype2str(lydctx->op_node->schema->nodetype));
+ lys_nodetype2str(lydctx->op_node->schema->nodetype));
ret = LY_EVALID;
goto cleanup;
}
@@ -1755,9 +1755,9 @@
/* finish rpc envelope */
ret = lydjson_object_envelope_close(lydctx->jsonctx, "rpc");
LY_CHECK_GOTO(ret, cleanup);
- if (!act_e && lydctx->op_node->schema->nodetype != LYS_RPC) {
+ if (!act_e && (lydctx->op_node->schema->nodetype != LYS_RPC)) {
LOGVAL(ctx, LY_VLOG_LYD, lydctx->op_node, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
- lys_nodetype2str(lydctx->op_node->schema->nodetype));
+ lys_nodetype2str(lydctx->op_node->schema->nodetype));
ret = LY_EVALID;
goto cleanup;
}