bc: tweak bc_num_parseDecimal() for readability, logic is not changed
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 14 Dec 2018 15:24:01 +0000 (16:24 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 14 Dec 2018 15:24:01 +0000 (16:24 +0100)
function                                             old     new   delta
zbc_program_num                                      836     835      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/bc.c

index 547af8eaf2ebe6f869cb4d9721529d52d84858de..2e8d044600477243e227c3b4c50be2079a7e2caf 100644 (file)
@@ -2334,13 +2334,13 @@ static void bc_num_parseDecimal(BcNum *n, const char *val)
                                n->num[n->len] = val[i] - '0';
                                ++n->len;
  skip_dot:
-                               if ((ssize_t)--i == (ssize_t)-1) break;
-                               if (val[i] == '.') goto skip_dot;
+                               if (i == 0) break;
+                               if (val[--i] == '.') goto skip_dot;
                        }
                        break;
                }
        }
-       // if this is reached, the value is entirely zero
+       // if for() exits without hitting if(), the value is entirely zero
 }
 
 // Note: n is already "bc_num_zero()"ed,