Skip to contentSkip to conversation

toml: fix misleading identation

PATCH In review Rosen Penev 2 participants 2 messages Apr 17, 2020 – Apr 20, 2020 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toml: fix misleading identation

Found with gcc's -Wmisleading-indentation

---
 utils/common/toml.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/common/toml.c +4 -2
index dc9868a2..68cebef9 100644
@@ -1697,7 +1697,8 @@ int toml_rtots(const char* src_, toml_timestamp_t* ret)
         for (i = 0; i < 10; i++, p++) {
             int xx = *p;
             if (xx == '-') {
-                if (i == 4 || i == 7) continue; return -1;
+                if (i == 4 || i == 7) continue;
+                return -1;
             }
             if (! ('0' <= xx && xx <= '9')) return -1;
             val = val * 10 + (xx - '0');
@@ -1724,7 +1725,8 @@ int toml_rtots(const char* src_, toml_timestamp_t* ret)
     for (i = 0; i < 8; i++, p++) {
         int xx = *p;
         if (xx == ':') {
-            if (i == 2 || i == 5) continue; return -1;
+            if (i == 2 || i == 5) continue;
+            return -1;
         }
         if (! ('0' <= xx && xx <= '9')) return -1;
         val = val * 10 + (xx - '0');
Signature · 1 line
2.25.2
#1 lore raw
Quoted 3 lines · Rosen Penev

Found with gcc's -Wmisleading-indentation

I've merged this with the '[PATCH] treewide: do not use return after else' patch.

I'll still mark it as Accepted in patchwork, though.

Regards,

Hans

Quoted 29 lines
---
 utils/common/toml.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/common/toml.c +4 -2
index dc9868a2..68cebef9 100644
@@ -1697,7 +1697,8 @@ int toml_rtots(const char* src_, toml_timestamp_t* ret)
         for (i = 0; i < 10; i++, p++) {
             int xx = *p;
             if (xx == '-') {
-                if (i == 4 || i == 7) continue; return -1;
+                if (i == 4 || i == 7) continue;
+                return -1;
             }
             if (! ('0' <= xx && xx <= '9')) return -1;
             val = val * 10 + (xx - '0');
@@ -1724,7 +1725,8 @@ int toml_rtots(const char* src_, toml_timestamp_t* ret)
     for (i = 0; i < 8; i++, p++) {
         int xx = *p;
         if (xx == ':') {
-            if (i == 2 || i == 5) continue; return -1;
+            if (i == 2 || i == 5) continue;
+            return -1;
         }
         if (! ('0' <= xx && xx <= '9')) return -1;
         val = val * 10 + (xx - '0');