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 03:38:24 +0100 |
commit | 22bb81fa85bc2a581c368923fe6d2bd80f74708f (patch) | |
tree | 6ef1e52ade8bbbc68b8feb2d520863490d23bb34 /coreutils | |
parent | 0b3a38b9f573634faa4f2bc8b0ffb6f55c0958f5 (diff) | |
download | busybox-w32-22bb81fa85bc2a581c368923fe6d2bd80f74708f.tar.gz busybox-w32-22bb81fa85bc2a581c368923fe6d2bd80f74708f.tar.bz2 busybox-w32-22bb81fa85bc2a581c368923fe6d2bd80f74708f.zip |
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')
-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) | |||
78 | unsigned len; | 78 | unsigned len; |
79 | *ptr = '\0'; | 79 | *ptr = '\0'; |
80 | # if ENABLE_UNICODE_SUPPORT | 80 | # if ENABLE_UNICODE_SUPPORT |
81 | { | 81 | len = unicode_strwidth(ptr_strbeg); |
82 | uni_stat_t uni_stat; | ||
83 | printable_string(&uni_stat, ptr_strbeg); | ||
84 | len = uni_stat.unicode_width; | ||
85 | } | ||
86 | # else | 82 | # else |
87 | len = ptr - ptr_strbeg; | 83 | len = ptr - ptr_strbeg; |
88 | # endif | 84 | # endif |
@@ -138,12 +134,9 @@ static void unexpand(FILE *file, unsigned tab_size, unsigned opt) | |||
138 | printf("%*s%.*s", len, "", n, ptr); | 134 | printf("%*s%.*s", len, "", n, ptr); |
139 | # if ENABLE_UNICODE_SUPPORT | 135 | # if ENABLE_UNICODE_SUPPORT |
140 | { | 136 | { |
141 | char c; | 137 | char c = ptr[n]; |
142 | uni_stat_t uni_stat; | ||
143 | c = ptr[n]; | ||
144 | ptr[n] = '\0'; | 138 | ptr[n] = '\0'; |
145 | printable_string(&uni_stat, ptr); | 139 | len = unicode_strwidth(ptr); |
146 | len = uni_stat.unicode_width; | ||
147 | ptr[n] = c; | 140 | ptr[n] = c; |
148 | } | 141 | } |
149 | # else | 142 | # else |