[git commit] ash,hush: run reinit_unicode() only if makes sense

Denys Vlasenko vda.linux at googlemail.com
Wed Aug 13 08:09:49 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=841f8331d79c642b4268dae52c382fab2da9cddc
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

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

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c  |    4 +++-
 shell/hush.c |   12 ++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index dc7a9bf..3b8aac5 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -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");
diff --git a/shell/hush.c b/shell/hush.c
index 7d35471..92d7901 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -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);
+	}
 }
 
 


More information about the busybox-cvs mailing list