ash,hush: run reinit_unicode() only if makes sense
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 13 Aug 2014 08:09:49 +0000 (10:09 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 13 Aug 2014 08:09:49 +0000 (10:09 +0200)
With static Unicode support, no need to check $LANG et al.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/hush.c

index dc7a9bf4fa076cd6156fb57a04f61281abde47cf..3b8aac55389b82e153a78be16965440bddaaec3d 100644 (file)
@@ -9661,7 +9661,9 @@ preadfd(void)
                 * _during_ shell execution, not only if it was set when
                 * 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");
                        if (!s) s = lookupvar("LC_CTYPE");
                        if (!s) s = lookupvar("LANG");
index 7d35471102b37a1ac99dc83b97612f9f4b56cda0..92d79018019fca42014e981d379307c143f5a639 100644 (file)
@@ -1985,10 +1985,14 @@ static void reinit_unicode_for_hush(void)
         * _during_ shell execution, not only if it was set when
         * shell was started. Therefore, re-check LANG every time:
         */
-       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);
+       if (ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
+        || ENABLE_UNICODE_USING_LOCALE
+        ) {
+               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);
+       }
 }