From a9a337f8598b831e08f2803315bce26f96d6d703 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 26 Sep 2011 13:24:08 -0600 Subject: 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 --- regexec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'regexec.c') diff --git a/regexec.c b/regexec.c index e6d3fa41df..1aa6129423 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 { \ -- cgit v1.2.1