diff options
author | Karl Williamson <khw@cpan.org> | 2014-12-09 20:57:52 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2015-02-17 10:05:38 -0700 |
commit | e60069689ad4de867417c9d3f1d8dce0cc0c8714 (patch) | |
tree | 187cb5ad26510a60a2b05a5157199919e872247a /pp_pack.c | |
parent | 9df874cdaa2f196cc11fbd7b82a85690c243eb9f (diff) | |
download | perl-e60069689ad4de867417c9d3f1d8dce0cc0c8714.tar.gz |
pp_pack.c: Refactor to remove #if EBCDIC
This commit causes the same code to be executed whether on an ASCII or
EBCDIC platform.
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -216,16 +216,8 @@ S_mul128(pTHX_ SV *sv, U8 m) /* Explosives and implosives. */ -#if 'I' == 73 && 'J' == 74 -/* On an ASCII/ISO kind of system */ -#define ISUUCHAR(ch) ((ch) >= ' ' && (ch) < 'a') -#else -/* - Some other sort of character set - use memchr() so we don't match - the null byte. - */ -#define ISUUCHAR(ch) (memchr(PL_uuemap, (ch), sizeof(PL_uuemap)-1) || (ch) == ' ') -#endif +#define ISUUCHAR(ch) (NATIVE_TO_LATIN1(ch) >= NATIVE_TO_LATIN1(' ') \ + && NATIVE_TO_LATIN1(ch) < NATIVE_TO_LATIN1('a')) /* type modifiers */ #define TYPE_IS_SHRIEKING 0x100 @@ -338,9 +330,10 @@ STATIC bool next_utf8_uu(pTHX_ const char **s, const char *end, I32 *out) { STRLEN retlen; - const UV val = utf8n_to_uvchr((U8 *) *s, end-*s, &retlen, UTF8_CHECK_ONLY); - if (val >= 0x100 || !ISUUCHAR(val) || - retlen == (STRLEN) -1 || retlen == 0) { + const UV val = NATIVE_TO_UNI(utf8n_to_uvchr((U8 *) *s, end-*s, &retlen, UTF8_CHECK_ONLY)); + if (val >= 0x100 || !ISUUCHAR(val) + || retlen == (STRLEN) -1 || retlen == 0) + { *out = 0; return FALSE; } @@ -1759,7 +1752,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c } } } else { - while (s < strend && *s > ' ' && ISUUCHAR(*s)) { + while (s < strend && *s != ' ' && ISUUCHAR(*s)) { I32 a, b, c, d; char hunk[3]; |