[PATCH 32/34] ul: use string printing function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use of for loop and printing a string character by character is slower
than to print whole string with single function.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 text-utils/ul.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/text-utils/ul.c b/text-utils/ul.c
index add419b..a69ac8a 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -448,8 +448,7 @@ static void overstrike(void)
 	putwchar('\r');
 	for (*cp = ' '; *cp == ' '; cp--)
 		*cp = 0;
-	for (cp = lbuf; *cp; cp++)
-		putwchar(*cp);
+	fputws(lbuf, stdout);
 	if (hadbold) {
 		putwchar('\r');
 		for (cp = lbuf; *cp; cp++)
@@ -482,8 +481,7 @@ static void iattr(void)
 		}
 	for (*cp = ' '; *cp == ' '; cp--)
 		*cp = 0;
-	for (cp = lbuf; *cp; cp++)
-		putwchar(*cp);
+	fputws(lbuf, stdout);
 	putwchar('\n');
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux