diff options
author | Karl Williamson <khw@cpan.org> | 2014-07-11 15:42:21 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-07-12 08:41:14 -0600 |
commit | 0080c90acf59b31e586bcf1d964eaf3d4220e8a5 (patch) | |
tree | eb473911f817cdd318ab6dbb27a3526d509e18c0 /locale.c | |
parent | 4c17e999c9ee0b1efabb2b96c6fbb1c7a2ad2822 (diff) | |
download | perl-0080c90acf59b31e586bcf1d964eaf3d4220e8a5.tar.gz |
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
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |