ash,hush: run reinit_unicode() only if makes sense

With static Unicode support, no need to check $LANG et al.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-08-13 10:09:49 +02:00
parent c538d5bcc3
commit 841f8331d7
2 changed files with 11 additions and 5 deletions

View File

@ -9661,7 +9661,9 @@ preadfd(void)
* _during_ shell execution, not only if it was set when * _during_ shell execution, not only if it was set when
* shell was started. Therefore, re-check LANG every time: * shell was started. Therefore, re-check LANG every time:
*/ */
{ if (ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
|| ENABLE_UNICODE_USING_LOCALE
) {
const char *s = lookupvar("LC_ALL"); const char *s = lookupvar("LC_ALL");
if (!s) s = lookupvar("LC_CTYPE"); if (!s) s = lookupvar("LC_CTYPE");
if (!s) s = lookupvar("LANG"); if (!s) s = lookupvar("LANG");

View File

@ -1985,10 +1985,14 @@ static void reinit_unicode_for_hush(void)
* _during_ shell execution, not only if it was set when * _during_ shell execution, not only if it was set when
* shell was started. Therefore, re-check LANG every time: * shell was started. Therefore, re-check LANG every time:
*/ */
const char *s = get_local_var_value("LC_ALL"); if (ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
if (!s) s = get_local_var_value("LC_CTYPE"); || ENABLE_UNICODE_USING_LOCALE
if (!s) s = get_local_var_value("LANG"); ) {
reinit_unicode(s); const char *s = get_local_var_value("LC_ALL");
if (!s) s = get_local_var_value("LC_CTYPE");
if (!s) s = get_local_var_value("LANG");
reinit_unicode(s);
}
} }