From: Karl Williamson Date: Mon, 26 Sep 2011 19:24:08 +0000 (-0600) Subject: regexec.c: Avoid hard-coded utf8 tests for EBCDIC X-Git-Tag: v5.15.4~203 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/a9a337f8598b831e08f2803315bce26f96d6d703 regexec.c: Avoid hard-coded utf8 tests for EBCDIC When a swash is loaded, generally it is checked for sanity with an assert(). The strings used are hard-coded utf8 strings, which will be different in EBCDIC, and hence will fail. I haven't figured out a simple way to get compile-time utf8 vs utfebcdic strings, but we can just skip the check in EBCDIC builds --- diff --git a/regexec.c b/regexec.c index e6d3fa4..1aa6129 100644 --- a/regexec.c +++ b/regexec.c @@ -122,12 +122,18 @@ #define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim)) /* these are unrolled below in the CCC_TRY_XXX defined */ -#define LOAD_UTF8_CHARCLASS(class,str) STMT_START { \ +#ifdef EBCDIC + /* Often 'str' is a hard-coded utf8 string instead of utfebcdic. so just + * skip the check on EBCDIC platforms */ +# define LOAD_UTF8_CHARCLASS(class,str) LOAD_UTF8_CHARCLASS_NO_CHECK(class) +#else +# define LOAD_UTF8_CHARCLASS(class,str) STMT_START { \ if (!CAT2(PL_utf8_,class)) { \ bool ok; \ ENTER; save_re_context(); \ ok=CAT2(is_utf8_,class)((const U8*)str); \ assert(ok); assert(CAT2(PL_utf8_,class)); LEAVE; } } STMT_END +#endif /* Doesn't do an assert to verify that is correct */ #define LOAD_UTF8_CHARCLASS_NO_CHECK(class) STMT_START { \