[git commit] bc: code shrink

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 18 18:20:04 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=30a8e0c2f9006db75840724ce89883595dfc7379
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
zbc_program_print                                    684     680      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-4)               Total: -4 bytes
   text	   data	    bss	    dec	    hex	filename
 981368	    485	   7296	 989149	  f17dd	busybox_old
 981364	    485	   7296	 989145	  f17d9	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 miscutils/bc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/miscutils/bc.c b/miscutils/bc.c
index eba8aa272..e62ca0f69 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -5290,7 +5290,7 @@ static FAST_FUNC void bc_num_printHex(size_t num, size_t width, bool radix)
 	if (radix) {
 		bc_num_printNewline();
 		bb_putchar('.');
-		G.prog.nchars += 1;
+		G.prog.nchars++;
 	}
 
 	bc_num_printNewline();
@@ -5302,8 +5302,10 @@ static void bc_num_printDecimal(BcNum *n)
 {
 	size_t i, rdx = n->rdx - 1;
 
-	if (n->neg) bb_putchar('-');
-	G.prog.nchars += n->neg;
+	if (n->neg) {
+		bb_putchar('-');
+		G.prog.nchars++;
+	}
 
 	for (i = n->len - 1; i < n->len; --i)
 		bc_num_printHex((size_t) n->num[i], 1, i == rdx);


More information about the busybox-cvs mailing list