This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Don't use isascii() as not in all libc's
authorKarl Williamson <public@khwilliamson.com>
Sun, 19 Sep 2010 17:57:04 +0000 (11:57 -0600)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 22 Sep 2010 22:56:17 +0000 (15:56 -0700)
EBCDIC platforms use isascii(), but is not in all libc's so better to
use our own.

handy.h

diff --git a/handy.h b/handy.h
index 9093175..f646029 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -530,12 +530,12 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 #define isBLANK(c)     ((c) == ' ' || (c) == '\t')
 #define isDIGIT(c)     ((c) >= '0' && (c) <= '9')
 #define isOCTAL(c)     ((c) >= '0' && (c) <= '7')
+#define isASCII(c)     (NATIVE_TO_UNI((U8) c) <= 127)
 #ifdef EBCDIC
     /* In EBCDIC we do not do locales: therefore() isupper() is fine. */
 #   define isUPPER(c)  isupper(c)
 #   define isLOWER(c)  islower(c)
 #   define isALNUMC(c) isalnum(c)
-#   define isASCII(c)  isascii(c)
 #   define isCNTRL(c)  iscntrl(c)
 #   define isGRAPH(c)  isgraph(c)
 #   define isPRINT(c)  isprint(c)
@@ -547,7 +547,6 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 #   define isUPPER(c)  ((c) >= 'A' && (c) <= 'Z')
 #   define isLOWER(c)  ((c) >= 'a' && (c) <= 'z')
 #   define isALNUMC(c) (isALPHA(c) || isDIGIT(c))
-#   define isASCII(c)  ((U8) (c) <= 127)
 #   define isCNTRL(c)  ((U8) (c) < ' ' || (c) == 127)
 #   define isGRAPH(c)  (isALNUM(c) || isPUNCT(c))
 #   define isPRINT(c)  (((c) >= 32 && (c) < 127))