From 0080c90acf59b31e586bcf1d964eaf3d4220e8a5 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Fri, 11 Jul 2014 15:42:21 -0600 Subject: locale.c: Skip compiling fallback code on modern platforms In the function that determines if a POSIX locale is UTF-8 or not, if either nl_langinfo or MB_CUR_MAX are defined, it can reliably determine the answer. If they are not defined, it uses heuristics to figure things out as best it can. This code doesn't add value for those platforms where one of the two symbols is defined, so can just be ifdef'd out --- locale.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'locale.c') diff --git a/locale.c b/locale.c index e4e665064d..ca138da53f 100644 --- a/locale.c +++ b/locale.c @@ -1158,7 +1158,9 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category) cant_use_nllanginfo: -#endif /* HAS_NL_LANGINFO etc */ +#else /* nl_langinfo should work if available, so don't bother compiling this + fallback code. The final fallback of looking at the name is + compiled, and will be executed if nl_langinfo fails */ /* nl_langinfo not available or failed somehow. Next try looking at the * currency symbol to see if it disambiguates things. Often that will be @@ -1315,6 +1317,8 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category) #endif +#endif /* the code that is compiled when no nl_langinfo */ + /* As a last resort, look at the locale name to see if it matches * qr/UTF -? * 8 /ix, or some other common locale names. This "name", the * return of setlocale(), is actually defined to be opaque, so we can't -- cgit v1.2.1