libyang FORMATTING manual changes before applying source_format
diff --git a/src/common.c b/src/common.c
index 11a4b9b..fcde3d8 100644
--- a/src/common.c
+++ b/src/common.c
@@ -321,8 +321,7 @@
/**
* @brief Static table of the UTF8 characters lengths according to their first byte.
*/
-static const unsigned char
-utf8_char_length_table[] = {
+static const unsigned char utf8_char_length_table[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
diff --git a/src/path.c b/src/path.c
index eb78599..dfd10e8 100644
--- a/src/path.c
+++ b/src/path.c
@@ -53,8 +53,9 @@
const char *name;
size_t name_len;
- /* '[' */
if (!lyxp_next_token(NULL, exp, tok_idx, LYXP_TOKEN_BRACK1)) {
+ /* '[' */
+
if (((pred == LY_PATH_PRED_SIMPLE) || (pred == LY_PATH_PRED_KEYS))
&& !lyxp_check_token(NULL, exp, *tok_idx, LYXP_TOKEN_NAMETEST)) {
set = ly_set_new();
@@ -110,8 +111,9 @@
/* '[' */
} while (!lyxp_next_token(NULL, exp, tok_idx, LYXP_TOKEN_BRACK1));
- /* '.' */
} else if ((pred == LY_PATH_PRED_SIMPLE) && !lyxp_next_token(NULL, exp, tok_idx, LYXP_TOKEN_DOT)) {
+ /* '.' */
+
/* '=' */
LY_CHECK_GOTO(lyxp_next_token(ctx, exp, tok_idx, LYXP_TOKEN_OPER_EQUAL), error);
@@ -121,8 +123,8 @@
/* ']' */
LY_CHECK_GOTO(lyxp_next_token(ctx, exp, tok_idx, LYXP_TOKEN_BRACK2), error);
- /* Number */
} else if ((pred == LY_PATH_PRED_SIMPLE) && !lyxp_next_token(NULL, exp, tok_idx, LYXP_TOKEN_NUMBER)) {
+ /* Number */
/* ']' */
LY_CHECK_GOTO(lyxp_next_token(ctx, exp, tok_idx, LYXP_TOKEN_BRACK2), error);
@@ -434,9 +436,8 @@
*pred_type = 0;
- /* '[' */
if (lyxp_next_token(NULL, expr, tok_idx, LYXP_TOKEN_BRACK1)) {
- /* no predicate */
+ /* '[', no predicate */
return LY_SUCCESS;
}
@@ -466,8 +467,8 @@
}
++(*tok_idx);
- /* new predicate */
if (!*pred_type) {
+ /* new predicate */
*pred_type = LY_PATH_PREDTYPE_LIST;
}
assert(*pred_type == LY_PATH_PREDTYPE_LIST);
@@ -578,9 +579,8 @@
const char *name;
size_t name_len;
- /* '[' */
if (lyxp_next_token(NULL, expr, tok_idx, LYXP_TOKEN_BRACK1)) {
- /* no predicate */
+ /* '[', no predicate */
return LY_SUCCESS;
}
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index cde221b..5541dd5 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -4061,8 +4061,7 @@
while (end->prev->module == mod) {
end = end->prev;
}
- } while ((end->prev->module != (*children)->module) && (end->prev->module != node->module)
- && (strcmp(mod->name, node->module->name) > 0));
+ } while ((end->prev->module != (*children)->module) && (end->prev->module != node->module) && (strcmp(mod->name, node->module->name) > 0));
/* we have the last existing node after our node, easily get the first before and connect it */
start = end->prev;
diff --git a/src/validation.c b/src/validation.c
index 316946a..16c776e 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -819,8 +819,8 @@
LY_CHECK_RET(lyd_validate_minmax(first, snode, sllist->min, sllist->max));
}
- /* check generic mandatory existence */
} else if (snode->flags & LYS_MAND_TRUE) {
+ /* check generic mandatory existence */
LY_CHECK_RET(lyd_validate_mandatory(first, snode));
}
diff --git a/src/xpath.c b/src/xpath.c
index c1f043e..9acb3c8 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -2055,9 +2055,8 @@
break;
}
- /* '//' RelativeLocationPath */
} else {
- /* '//' */
+ /* '//' RelativeLocationPath */
++(*tok_idx);
rc = reparse_relative_location_path(ctx, exp, tok_idx);
@@ -6276,12 +6275,12 @@
return LY_EINCOMPLETE;
}
- /* node already there can also be the root */
if (!new_node) {
+ /* node already there can also be the root */
new_type = set->root_type;
- /* node has a standard parent (it can equal the root, it's not the root yet since they are fake) */
} else {
+ /* node has a standard parent (it can equal the root, it's not the root yet since they are fake) */
new_type = LYXP_NODE_ELEM;
}
@@ -6352,12 +6351,12 @@
continue;
}
- /* node has no parent */
if (!new_node) {
+ /* node has no parent */
new_type = set->root_type;
- /* node has a standard parent (it can equal the root, it's not the root yet since they are fake) */
} else {
+ /* node has a standard parent (it can equal the root, it's not the root yet since they are fake) */
new_type = LYXP_NODE_ELEM;
}
@@ -7257,8 +7256,8 @@
break;
}
- /* '//' RelativeLocationPath */
} else {
+ /* '//' RelativeLocationPath */
/* evaluate '//' - deferred so as not to waste memory by remembering all the nodes */
all_desc = 1;
LOGDBG(LY_LDGXPATH, "%-27s %s %s[%u]", __func__, (set ? "parsed" : "skipped"),