aboutsummaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2009-12-14 21:00:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:32 -0500
commitb5ff992b09dbe06a4a020fbb702e29ab61290cc5 (patch)
treeb23916d07465dc4a2dbd011d2497491e5e217e5d /lib/vsprintf.c
parent08562cb27da6a1472be15898173105b46801a73b (diff)
vsprintf: reduce code size by avoiding extra check
No functional change, just refactor the code so that it avoid checking "if (hi)" two times in a sequence, taking advantage of previous check made. It also reduces code size: text data bss dec hex filename 15726 0 8 15734 3d76 vsprintf.o (ex lib/lib.a-BEFORE) 15710 0 8 15718 3d66 vsprintf.o (ex lib/lib.a-AFTER) Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index cba2385a6f0b..4819c3d6cca4 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -797,8 +797,9 @@ static char *ip6_compressed_string(char *p, const char *addr)
797 p = pack_hex_byte(p, hi); 797 p = pack_hex_byte(p, hi);
798 else 798 else
799 *p++ = hex_asc_lo(hi); 799 *p++ = hex_asc_lo(hi);
800 p = pack_hex_byte(p, lo);
800 } 801 }
801 if (hi || lo > 0x0f) 802 else if (lo > 0x0f)
802 p = pack_hex_byte(p, lo); 803 p = pack_hex_byte(p, lo);
803 else 804 else
804 *p++ = hex_asc_lo(lo); 805 *p++ = hex_asc_lo(lo);