diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-27 01:18:07 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-03-27 01:18:07 +0100 |
commit | 353680aa46dc91ecfd80dd19db131de7aa90bd22 (patch) | |
tree | 05de26c20457b407fa59501708d3b31d2aa081f5 /libbb/unicode.c | |
parent | 19311bfa7b8e8c6effa9c375de9b0eb4338bee12 (diff) |
lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=y
function old new delta
load_string 45 91 +46
save_string 40 82 +42
reinit_unicode 34 61 +27
BB_PUTCHAR 97 120 +23
init_unicode 17 37 +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 158/0) Total: 158 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r-- | libbb/unicode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c index d01efd9a2..99dc1dfa6 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -23,12 +23,13 @@ uint8_t unicode_status; /* Unicode support using libc locale support. */ -void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM) +void FAST_FUNC reinit_unicode(const char *LANG) { static const char unicode_0x394[] = { 0xce, 0x94, 0 }; size_t width; -//TODO: call setlocale(LC_ALL, LANG) here? +//TODO: avoid repeated calls by caching last string? + setlocale(LC_ALL, (LANG && LANG[0]) ? LANG : "C"); /* In unicode, this is a one character string */ // can use unicode_strlen(string) too, but otherwise unicode_strlen() is unused @@ -39,7 +40,7 @@ void FAST_FUNC reinit_unicode(const char *LANG UNUSED_PARAM) void FAST_FUNC init_unicode(void) { if (unicode_status == UNICODE_UNKNOWN) - reinit_unicode(NULL /*getenv("LANG")*/); + reinit_unicode(getenv("LANG")); } #else |