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

Sami Kerola
2013-07-07T19:56:39Z

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@iki.fi>
---
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