diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2013-12-09 16:09:35 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-12-16 06:38:24 +0400 |
commit | 22bb81fa85bc2a581c368923fe6d2bd80f74708f (patch) | |
tree | 6ef1e52ade8bbbc68b8feb2d520863490d23bb34 /coreutils/expand.c | |
parent | 0b3a38b9f573634faa4f2bc8b0ffb6f55c0958f5 (diff) |
expand: use printable_string instead of hard-coding implementation
function old new delta
expand_main 709 690 -19
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/expand.c')
-rw-r--r-- | coreutils/expand.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/coreutils/expand.c b/coreutils/expand.c index 25bbffc66..8d376ff4e 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c @@ -78,11 +78,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt) unsigned len; *ptr = '\0'; # if ENABLE_UNICODE_SUPPORT - { - uni_stat_t uni_stat; - printable_string(&uni_stat, ptr_strbeg); - len = uni_stat.unicode_width; - } + len = unicode_strwidth(ptr_strbeg); # else len = ptr - ptr_strbeg; # endif @@ -138,12 +134,9 @@ static void unexpand(FILE *file, unsigned tab_size, unsigned opt) printf("%*s%.*s", len, "", n, ptr); # if ENABLE_UNICODE_SUPPORT { - char c; - uni_stat_t uni_stat; - c = ptr[n]; + char c = ptr[n]; ptr[n] = '\0'; - printable_string(&uni_stat, ptr); - len = uni_stat.unicode_width; + len = unicode_strwidth(ptr); ptr[n] = c; } # else |