From 353680aa46dc91ecfd80dd19db131de7aa90bd22 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Mar 2011 01:18:07 +0100 Subject: 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 --- libbb/unicode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libbb/unicode.c') 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 -- cgit v1.2.3