aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 13:22:23 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-18 13:22:23 +0100
commitd4258dd321dfdfd9586fb588f17f2a61fa7829d2 (patch)
tree24f97d3a70251b5459dd87caee2d2791e7c7b6c8
parent5c0c5abba09c7bab423d1261920d8c73c5eac939 (diff)
downloadbusybox-w32-d4258dd321dfdfd9586fb588f17f2a61fa7829d2.tar.gz
busybox-w32-d4258dd321dfdfd9586fb588f17f2a61fa7829d2.tar.bz2
busybox-w32-d4258dd321dfdfd9586fb588f17f2a61fa7829d2.zip
bc: another for() loop simplified
function old new delta zbc_program_print 688 686 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c12
1 files 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:
5448static BC_STATUS zbc_num_printBase(BcNum *n) 5448static BC_STATUS zbc_num_printBase(BcNum *n)
5449{ 5449{
5450 BcStatus s; 5450 BcStatus s;
5451 size_t width, i; 5451 size_t width;
5452 BcNumDigitOp print; 5452 BcNumDigitOp print;
5453 bool neg = n->neg; 5453 bool neg = n->neg;
5454 5454
@@ -5463,8 +5463,14 @@ static BC_STATUS zbc_num_printBase(BcNum *n)
5463 width = 1; 5463 width = 1;
5464 print = bc_num_printHex; 5464 print = bc_num_printHex;
5465 } else { 5465 } else {
5466 for (i = G.prog.ob_t - 1, width = 0; i != 0; i /= 10, ++width) 5466 unsigned i = G.prog.ob_t - 1;
5467 continue; 5467 width = 0;
5468 for (;;) {
5469 width++;
5470 i /= 10;
5471 if (i == 0)
5472 break;
5473 }
5468 print = bc_num_printDigits; 5474 print = bc_num_printDigits;
5469 } 5475 }
5470 5476