[git commit] bc: another for() loop simplified
Denys Vlasenko
vda.linux at googlemail.com
Tue Dec 18 12:22:23 UTC 2018
commit: https://git.busybox.net/busybox/commit/?id=d4258dd321dfdfd9586fb588f17f2a61fa7829d2
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
zbc_program_print 688 686 -2
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
miscutils/bc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 4b5cac08a..37c9012f9 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -5448,7 +5448,7 @@ err:
static BC_STATUS zbc_num_printBase(BcNum *n)
{
BcStatus s;
- size_t width, i;
+ size_t width;
BcNumDigitOp print;
bool neg = n->neg;
@@ -5463,8 +5463,14 @@ static BC_STATUS zbc_num_printBase(BcNum *n)
width = 1;
print = bc_num_printHex;
} else {
- for (i = G.prog.ob_t - 1, width = 0; i != 0; i /= 10, ++width)
- continue;
+ unsigned i = G.prog.ob_t - 1;
+ width = 0;
+ for (;;) {
+ width++;
+ i /= 10;
+ if (i == 0)
+ break;
+ }
print = bc_num_printDigits;
}
More information about the busybox-cvs
mailing list