summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-12-09 20:57:52 -0700
committerKarl Williamson <khw@cpan.org>2015-02-17 10:05:38 -0700
commite60069689ad4de867417c9d3f1d8dce0cc0c8714 (patch)
tree187cb5ad26510a60a2b05a5157199919e872247a /pp_pack.c
parent9df874cdaa2f196cc11fbd7b82a85690c243eb9f (diff)
downloadperl-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.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 47a12a50ac..76e959864c 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -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];