libyang MAINTENANCE source code formatting
diff --git a/src/json.c b/src/json.c
index e52b3de..09b6303 100644
--- a/src/json.c
+++ b/src/json.c
@@ -170,7 +170,7 @@
* (one-char) entities and character references */
if (len + offset + 4 >= size) {
size_t increment;
- for (increment = BUFSIZE_STEP; len + offset + 4 >= size + increment; increment += BUFSIZE_STEP) ;
+ for (increment = BUFSIZE_STEP; len + offset + 4 >= size + increment; increment += BUFSIZE_STEP) {}
buf = ly_realloc(buf, size + increment);
LY_CHECK_ERR_RET(!buf, LOGMEM(jsonctx->ctx), LY_EMEM);
size += BUFSIZE_STEP;
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 826cf30..4e759b2 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1039,7 +1039,7 @@
/* submodule not present in the main module, get the input data and parse it */
if (!(ctx->flags & LY_CTX_PREFER_SEARCHDIRS)) {
- search_clb:
+search_clb:
if (ctx->imp_clb) {
const char *submodule_data = NULL;
LYS_INFORMAT format = LYS_IN_UNKNOWN;
@@ -1070,7 +1070,7 @@
goto search_file;
}
} else {
- search_file:
+search_file:
if (!(ctx->flags & LY_CTX_DISABLE_SEARCHDIRS)) {
/* submodule was not received from the callback or there is no callback set */
lys_module_localfile(ctx, inc->name,
@@ -1780,8 +1780,8 @@
const struct lysc_node *parent;
parent = schema;
- while (parent && !(parent->nodetype & (LYS_CONTAINER | LYS_LEAF | LYS_LEAFLIST | LYS_LIST | LYS_ANYDATA | LYS_RPC
- | LYS_ACTION | LYS_NOTIF))) {
+ while (parent && !(parent->nodetype & (LYS_CONTAINER | LYS_LEAF | LYS_LEAFLIST | LYS_LIST | LYS_ANYDATA | LYS_RPC |
+ LYS_ACTION | LYS_NOTIF))) {
parent = lysc_node_parent_full(parent);
}
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 63af49d..66dba0d 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -477,6 +477,7 @@
uint16_t flags = 0;
uint32_t value = 0;
struct lysp_ext_instance *ext = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
in.current = " 1invalid; ...";
@@ -950,6 +951,7 @@
test_container(void **state)
{
struct lysp_node_container *c = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1052,6 +1054,7 @@
test_leaflist(void **state)
{
struct lysp_node_leaflist *ll = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1118,6 +1121,7 @@
test_list(void **state)
{
struct lysp_node_list *l = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1168,6 +1172,7 @@
test_choice(void **state)
{
struct lysp_node_choice *ch = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1205,6 +1210,7 @@
test_case(void **state)
{
struct lysp_node_case *cs = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1238,6 +1244,7 @@
test_any(void **state, enum ly_stmt kw)
{
struct lysp_node_anydata *any = NULL;
+
if (kw == LY_STMT_ANYDATA) {
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
} else {
@@ -1285,6 +1292,7 @@
test_grouping(void **state)
{
struct lysp_grp *grp = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1331,6 +1339,7 @@
{
struct lysp_action *rpcs = NULL;
struct lysp_node_container *c = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1398,6 +1407,7 @@
{
struct lysp_notif *notifs = NULL;
struct lysp_node_container *c = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1447,6 +1457,7 @@
test_uses(void **state)
{
struct lysp_node_uses *u = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1475,6 +1486,7 @@
test_augment(void **state)
{
struct lysp_augment *a = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
@@ -1511,6 +1523,7 @@
test_when(void **state)
{
struct lysp_when *w = NULL;
+
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
/* invalid cardinality */
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index 08f954c..8d9e42e 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -672,10 +672,10 @@
{
/* YANG 1.0 - the missing include sub_a_two in main_a will be injected from sub_a_one */
struct module_clb_list list[] = {
- {"main_a", "module main_a { namespace urn:test:main_a; prefix ma; include sub_a_one;}"},
- {"sub_a_one", "submodule sub_a_one { belongs-to main_a { prefix ma; } include sub_a_two;}"},
- {"sub_a_two", "submodule sub_a_two { belongs-to main_a { prefix ma; } }"},
- {NULL, NULL}
+ {"main_a", "module main_a { namespace urn:test:main_a; prefix ma; include sub_a_one;}"},
+ {"sub_a_one", "submodule sub_a_one { belongs-to main_a { prefix ma; } include sub_a_two;}"},
+ {"sub_a_two", "submodule sub_a_two { belongs-to main_a { prefix ma; } }"},
+ {NULL, NULL}
};
ly_ctx_set_module_imp_clb(UTEST_LYCTX, module_clb, list);
mod = ly_ctx_load_module(UTEST_LYCTX, "main_a", NULL, NULL);
@@ -687,10 +687,10 @@
{
/* YANG 1.1 - the missing include sub_b_two in main_b is error */
struct module_clb_list list[] = {
- {"main_b", "module main_b { yang-version 1.1; namespace urn:test:main_b; prefix mb; include sub_b_one;}"},
- {"sub_b_one", "submodule sub_b_one { yang-version 1.1; belongs-to main_b { prefix mb; } include sub_b_two;}"},
- {"sub_b_two", "submodule sub_b_two { yang-version 1.1; belongs-to main_b { prefix mb; } }"},
- {NULL, NULL}
+ {"main_b", "module main_b { yang-version 1.1; namespace urn:test:main_b; prefix mb; include sub_b_one;}"},
+ {"sub_b_one", "submodule sub_b_one { yang-version 1.1; belongs-to main_b { prefix mb; } include sub_b_two;}"},
+ {"sub_b_two", "submodule sub_b_two { yang-version 1.1; belongs-to main_b { prefix mb; } }"},
+ {NULL, NULL}
};
ly_ctx_set_module_imp_clb(UTEST_LYCTX, module_clb, list);
mod = ly_ctx_load_module(UTEST_LYCTX, "main_b", NULL, NULL);
@@ -706,10 +706,10 @@
{
/* YANG 1.1 - all includes are in main_c, includes in submodules are not necessary, so expect warning */
struct module_clb_list list[] = {
- {"main_c", "module main_c { yang-version 1.1; namespace urn:test:main_c; prefix mc; include sub_c_one; include sub_c_two;}"},
- {"sub_c_one", "submodule sub_c_one { yang-version 1.1; belongs-to main_c { prefix mc; } include sub_c_two;}"},
- {"sub_c_two", "submodule sub_c_two { yang-version 1.1; belongs-to main_c { prefix mc; } }"},
- {NULL, NULL}
+ {"main_c", "module main_c { yang-version 1.1; namespace urn:test:main_c; prefix mc; include sub_c_one; include sub_c_two;}"},
+ {"sub_c_one", "submodule sub_c_one { yang-version 1.1; belongs-to main_c { prefix mc; } include sub_c_two;}"},
+ {"sub_c_two", "submodule sub_c_two { yang-version 1.1; belongs-to main_c { prefix mc; } }"},
+ {NULL, NULL}
};
ly_ctx_set_module_imp_clb(UTEST_LYCTX, module_clb, list);
mod = ly_ctx_load_module(UTEST_LYCTX, "main_c", NULL, NULL);