[git commit] bc: tweak bc_num_parseDecimal() for readability, logic is not changed
Denys Vlasenko
vda.linux at googlemail.com
Fri Dec 14 15:24:01 UTC 2018
commit: https://git.busybox.net/busybox/commit/?id=87b49beeda51ef708e5b83c908edeab1ca88339b
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
zbc_program_num 836 835 -1
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
miscutils/bc.c | 6 +++---
1 file 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)
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,
More information about the busybox-cvs
mailing list