This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
No need for swashes for properties that are ASCII-only
authorKarl Williamson <public@khwilliamson.com>
Sat, 24 Sep 2011 18:19:42 +0000 (12:19 -0600)
committerKarl Williamson <public@khwilliamson.com>
Sat, 1 Oct 2011 15:58:08 +0000 (09:58 -0600)
These three properties are restricted to being true only for ASCII
characters.  That information is compiled into Perl, so no need to
create swashes for them.

embedvar.h
intrpvar.h
utf8.c

index f468bd8..090e36c 100644 (file)
 #define PL_utf8_idstart                (vTHX->Iutf8_idstart)
 #define PL_utf8_lower          (vTHX->Iutf8_lower)
 #define PL_utf8_mark           (vTHX->Iutf8_mark)
-#define PL_utf8_perl_space     (vTHX->Iutf8_perl_space)
-#define PL_utf8_perl_word      (vTHX->Iutf8_perl_word)
-#define PL_utf8_posix_digit    (vTHX->Iutf8_posix_digit)
 #define PL_utf8_print          (vTHX->Iutf8_print)
 #define PL_utf8_punct          (vTHX->Iutf8_punct)
 #define PL_utf8_space          (vTHX->Iutf8_space)
index dae9b84..09154b7 100644 (file)
@@ -573,9 +573,6 @@ PERLVAR(I, numeric_radix_sv, SV *)  /* The radix separator if not '.' */
 PERLVAR(I, utf8_alnum, SV *)
 PERLVAR(I, utf8_alpha, SV *)
 PERLVAR(I, utf8_space, SV *)
-PERLVAR(I, utf8_perl_space, SV *)
-PERLVAR(I, utf8_perl_word, SV *)
-PERLVAR(I, utf8_posix_digit, SV *)
 PERLVAR(I, utf8_cntrl, SV *)
 PERLVAR(I, utf8_graph, SV *)
 PERLVAR(I, utf8_digit, SV *)
diff --git a/utf8.c b/utf8.c
index 83cc3d1..c7efcf1 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -1574,7 +1574,9 @@ Perl_is_utf8_perl_space(pTHX_ const U8 *p)
 
     PERL_ARGS_ASSERT_IS_UTF8_PERL_SPACE;
 
-    return is_utf8_common(p, &PL_utf8_perl_space, "IsPerlSpace");
+    /* Only true if is an ASCII space-like character, and ASCII is invariant
+     * under utf8, so can just use the macro */
+    return isSPACE_A(*p);
 }
 
 bool
@@ -1584,7 +1586,9 @@ Perl_is_utf8_perl_word(pTHX_ const U8 *p)
 
     PERL_ARGS_ASSERT_IS_UTF8_PERL_WORD;
 
-    return is_utf8_common(p, &PL_utf8_perl_word, "IsPerlWord");
+    /* Only true if is an ASCII word character, and ASCII is invariant
+     * under utf8, so can just use the macro */
+    return isWORDCHAR_A(*p);
 }
 
 bool
@@ -1604,7 +1608,9 @@ Perl_is_utf8_posix_digit(pTHX_ const U8 *p)
 
     PERL_ARGS_ASSERT_IS_UTF8_POSIX_DIGIT;
 
-    return is_utf8_common(p, &PL_utf8_posix_digit, "IsPosixDigit");
+    /* Only true if is an ASCII digit character, and ASCII is invariant
+     * under utf8, so can just use the macro */
+    return isDIGIT_A(*p);
 }
 
 bool