]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ul: use string printing function
authorSami Kerola <kerolasa@iki.fi>
Sun, 7 Jul 2013 19:54:47 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Jul 2013 12:25:55 +0000 (14:25 +0200)
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

index 26d2b172d2cbfc1f319336232419ae77711875a2..b3b3dc354c363bfc3011d68a2b0f10313bb4be9d 100644 (file)
@@ -447,8 +447,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++)
@@ -481,8 +480,7 @@ static void iattr(void)
                }
        for (*cp = ' '; *cp == ' '; cp--)
                *cp = 0;
-       for (cp = lbuf; *cp; cp++)
-               putwchar(*cp);
+       fputws(lbuf, stdout);
        putwchar('\n');
 }