diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-19 16:44:05 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-19 16:44:05 +0200 |
commit | 7a18043a968ec6d4b8c4c8cac059ad977d14e47c (patch) | |
tree | 3f2926bc556542b689d284338a7137ede9544d56 /libbb/unicode.c | |
parent | 8395bd3f52f8ed46fa3ffc316b2d113afa748bae (diff) | |
download | busybox-w32-7a18043a968ec6d4b8c4c8cac059ad977d14e47c.tar.gz busybox-w32-7a18043a968ec6d4b8c4c8cac059ad977d14e47c.tar.bz2 busybox-w32-7a18043a968ec6d4b8c4c8cac059ad977d14e47c.zip |
lineedit: improve Unicode handling (still buggy though)
function old new delta
unicode_strlen - 31 +31
read_line_input 3876 3879 +3
lineedit_read_key 255 246 -9
parse_and_put_prompt 785 755 -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 34/-39) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r-- | libbb/unicode.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c index 2e5dd5adc..9c4da50d3 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c | |||
@@ -43,8 +43,7 @@ void FAST_FUNC reinit_unicode(const char *LANG) | |||
43 | setlocale(LC_CTYPE, LANG ? LANG : ""); | 43 | setlocale(LC_CTYPE, LANG ? LANG : ""); |
44 | 44 | ||
45 | /* In unicode, this is a one character string */ | 45 | /* In unicode, this is a one character string */ |
46 | // can use unicode_strlen(string) too, but otherwise unicode_strlen() is unused | 46 | width = unicode_strlen(unicode_0x394); |
47 | width = mbstowcs(NULL, unicode_0x394, INT_MAX); | ||
48 | unicode_status = (width == 1 ? UNICODE_ON : UNICODE_OFF); | 47 | unicode_status = (width == 1 ? UNICODE_ON : UNICODE_OFF); |
49 | } | 48 | } |
50 | 49 | ||
@@ -986,7 +985,6 @@ int FAST_FUNC unicode_bidi_is_neutral_wchar(wint_t wc) | |||
986 | 985 | ||
987 | /* The rest is mostly same for libc and for "homegrown" support */ | 986 | /* The rest is mostly same for libc and for "homegrown" support */ |
988 | 987 | ||
989 | #if 0 // UNUSED | ||
990 | size_t FAST_FUNC unicode_strlen(const char *string) | 988 | size_t FAST_FUNC unicode_strlen(const char *string) |
991 | { | 989 | { |
992 | size_t width = mbstowcs(NULL, string, INT_MAX); | 990 | size_t width = mbstowcs(NULL, string, INT_MAX); |
@@ -994,7 +992,6 @@ size_t FAST_FUNC unicode_strlen(const char *string) | |||
994 | return strlen(string); | 992 | return strlen(string); |
995 | return width; | 993 | return width; |
996 | } | 994 | } |
997 | #endif | ||
998 | 995 | ||
999 | size_t FAST_FUNC unicode_strwidth(const char *string) | 996 | size_t FAST_FUNC unicode_strwidth(const char *string) |
1000 | { | 997 | { |