In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/21732d5c67323d747a91102253591325b3569ec3?hp=7f8f1c2613d1d5df0b1071bd5fe3eec808c4a69e>
- Log ----------------------------------------------------------------- commit 21732d5c67323d747a91102253591325b3569ec3 Author: Karl Williamson <[email protected]> Date: Tue Jan 27 11:41:55 2015 -0700 loc_tools.pl: do a 'require' before module's function call This was failing to do the require before testing if the function in the module existed, so if the require hadn't been done by someone else, it would show as not existing, and so would fail unnecessarily. The other fix is to not assume the require has been done, so in the right circumstances, this could have an undefined function error. But all current uses had already done the require, so this bug has yet to show up. M t/loc_tools.pl commit 44129e4698cf2866be96e739c41415dda2b74567 Author: Karl Williamson <[email protected]> Date: Mon Jan 26 22:40:28 2015 -0700 regexec.c: Rmv 2 unused macro parameters. M regexec.c ----------------------------------------------------------------------- Summary of changes: regexec.c | 8 ++++---- t/loc_tools.pl | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/regexec.c b/regexec.c index dc940c3..8e22a4f 100644 --- a/regexec.c +++ b/regexec.c @@ -1713,7 +1713,7 @@ REXEC_FBC_SCAN( /* Loops while (s < strend) */ \ FBC_UTF8(TEST_UV, TEST_UTF8, REXEC_FBC_TRYIT, PLACEHOLDER), \ TEST_NON_UTF8, REXEC_FBC_TRYIT, PLACEHOLDER) -#define FBC_BOUND_A(TEST_NON_UTF8, TEST_UV, TEST_UTF8) \ +#define FBC_BOUND_A(TEST_NON_UTF8) \ FBC_BOUND_COMMON( \ FBC_UTF8_A(TEST_NON_UTF8, REXEC_FBC_TRYIT, PLACEHOLDER), \ TEST_NON_UTF8, REXEC_FBC_TRYIT, PLACEHOLDER) @@ -1723,7 +1723,7 @@ REXEC_FBC_SCAN( /* Loops while (s < strend) */ \ FBC_UTF8(TEST_UV, TEST_UTF8, PLACEHOLDER, REXEC_FBC_TRYIT), \ TEST_NON_UTF8, PLACEHOLDER, REXEC_FBC_TRYIT) -#define FBC_NBOUND_A(TEST_NON_UTF8, TEST_UV, TEST_UTF8) \ +#define FBC_NBOUND_A(TEST_NON_UTF8) \ FBC_BOUND_COMMON( \ FBC_UTF8_A(TEST_NON_UTF8, PLACEHOLDER, REXEC_FBC_TRYIT), \ TEST_NON_UTF8, PLACEHOLDER, REXEC_FBC_TRYIT) @@ -1947,13 +1947,13 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, FBC_BOUND(isWORDCHAR, isWORDCHAR_uni, isWORDCHAR_utf8); break; case BOUNDA: - FBC_BOUND_A(isWORDCHAR_A, isWORDCHAR_A, isWORDCHAR_A); + FBC_BOUND_A(isWORDCHAR_A); break; case NBOUND: FBC_NBOUND(isWORDCHAR, isWORDCHAR_uni, isWORDCHAR_utf8); break; case NBOUNDA: - FBC_NBOUND_A(isWORDCHAR_A, isWORDCHAR_A, isWORDCHAR_A); + FBC_NBOUND_A(isWORDCHAR_A); break; case BOUNDU: FBC_BOUND(isWORDCHAR_L1, isWORDCHAR_uni, isWORDCHAR_utf8); diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 502af60..6a6cdf4 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -227,6 +227,9 @@ sub is_locale_utf8 ($) { # Return a boolean as to if core Perl thinks the input # On z/OS, even locales marked as UTF-8 aren't. return 0 if ord "A" != 65; + eval { require POSIX; import POSIX 'locale_h'; }; + return 0 if ! defined &POSIX::LC_CTYPE; + my $locale = shift; use locale; @@ -272,8 +275,11 @@ sub find_utf8_ctype_locale (;$) { # Return the name of a locale that core Perl # tries all locales it can find on the # platform my $locales_ref = shift; - return if !defined &POSIX::LC_CTYPE; + if (! defined $locales_ref) { + eval { require POSIX; import POSIX 'locale_h'; }; + return if ! defined &POSIX::LC_CTYPE; + my @locales = find_locales(&POSIX::LC_CTYPE(), 1 # Reject iffy locales. ); -- Perl5 Master Repository
