diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-14 16:24:01 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-14 16:24:01 +0100 |
| commit | 87b49beeda51ef708e5b83c908edeab1ca88339b (patch) | |
| tree | 507ce6fa38633ae0a9c357bf2cf7970c4a2837d8 | |
| parent | 240d7ee3fcff86b557cfac12cb74073e119957a1 (diff) | |
| download | busybox-w32-87b49beeda51ef708e5b83c908edeab1ca88339b.tar.gz busybox-w32-87b49beeda51ef708e5b83c908edeab1ca88339b.tar.bz2 busybox-w32-87b49beeda51ef708e5b83c908edeab1ca88339b.zip | |
bc: tweak bc_num_parseDecimal() for readability, logic is not changed
function old new delta
zbc_program_num 836 835 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | miscutils/bc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 547af8eaf..2e8d04460 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
| @@ -2334,13 +2334,13 @@ static void bc_num_parseDecimal(BcNum *n, const char *val) | |||
| 2334 | n->num[n->len] = val[i] - '0'; | 2334 | n->num[n->len] = val[i] - '0'; |
| 2335 | ++n->len; | 2335 | ++n->len; |
| 2336 | skip_dot: | 2336 | skip_dot: |
| 2337 | if ((ssize_t)--i == (ssize_t)-1) break; | 2337 | if (i == 0) break; |
| 2338 | if (val[i] == '.') goto skip_dot; | 2338 | if (val[--i] == '.') goto skip_dot; |
| 2339 | } | 2339 | } |
| 2340 | break; | 2340 | break; |
| 2341 | } | 2341 | } |
| 2342 | } | 2342 | } |
| 2343 | // if this is reached, the value is entirely zero | 2343 | // if for() exits without hitting if(), the value is entirely zero |
| 2344 | } | 2344 | } |
| 2345 | 2345 | ||
| 2346 | // Note: n is already "bc_num_zero()"ed, | 2346 | // Note: n is already "bc_num_zero()"ed, |
