libyang MAINTENANCE change format of the empty loops
To improve readability and because of processing by the formatting
tools, add explicit empty block to the empty loops (for, while).
diff --git a/src/common.c b/src/common.c
index 7a8d83a..11a4b9b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -344,10 +344,13 @@
size_t
ly_utf8len(const char *str, size_t bytes)
{
- size_t len;
- const char *ptr;
+ size_t len = 0;
+ const char *ptr = str;
- for (len = 0, ptr = str; *ptr && (size_t)(ptr - str) < bytes; ++len, ptr += utf8_char_length_table[((unsigned char)(*ptr))]);
+ while(*ptr && (size_t)(ptr - str) < bytes) {
+ ++len;
+ ptr += utf8_char_length_table[((unsigned char)(*ptr))];
+ }
return len;
}
@@ -360,7 +363,7 @@
} else if (!str[0]) {
return 1;
}
- for (len = 1; len < LY_VCODE_INSTREXP_MAXLEN && str[len]; ++len);
+ for (len = 1; len < LY_VCODE_INSTREXP_MAXLEN && str[len]; ++len) {}
return len;
}
@@ -581,7 +584,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 "]" */
@@ -593,7 +596,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] == '.') {
@@ -625,7 +628,7 @@
if (expr) {
/* *WSP "=" *WSP quoted-string *WSP "]" */
- for (; isspace(in[offset]); offset++);
+ for (; isspace(in[offset]); offset++) {}
if (in[offset] != '=') {
if (expr == 1) {
@@ -636,7 +639,7 @@
goto error;
}
offset++;
- for (; isspace(in[offset]); offset++);
+ for (; isspace(in[offset]); offset++) {}
/* quoted-string */
quot = in[offset++];
@@ -645,7 +648,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++;
@@ -656,7 +659,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.";