summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-10-30 21:38:29 +0000
committerNicholas Clark <nick@ccl4.org>2005-10-30 21:38:29 +0000
commit671c33bff945cf11371c6f4b51ad63cb17e83f55 (patch)
tree9f93a2f91aa22ae81e3df54ff839365307e75796 /utf8.c
parent4abdcbc71156b739b85f79e712697dce357ec625 (diff)
downloadperl-671c33bff945cf11371c6f4b51ad63cb17e83f55.tar.gz
is_utf8_alnum() and is_utf8_alnumc() can use is_utf8_common() too.
p4raw-id: //depot/perl@25909
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/utf8.c b/utf8.c
index f2026c2251..28947a361c 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1250,38 +1250,16 @@ S_is_utf8_common(pTHX_ const U8 const *p, SV **swash,
bool
Perl_is_utf8_alnum(pTHX_ const U8 *p)
{
- if (!is_utf8_char(p))
- return FALSE;
- if (!PL_utf8_alnum)
- /* NOTE: "IsWord", not "IsAlnum", since Alnum is a true
- * descendant of isalnum(3), in other words, it doesn't
- * contain the '_'. --jhi */
- PL_utf8_alnum = swash_init("utf8", "IsWord", &PL_sv_undef, 0, 0);
- return swash_fetch(PL_utf8_alnum, p, TRUE) != 0;
-/* return *p == '_' || is_utf8_alpha(p) || is_utf8_digit(p); */
-#ifdef SURPRISINGLY_SLOWER /* probably because alpha is usually true */
- if (!PL_utf8_alnum)
- PL_utf8_alnum = swash_init("utf8", "",
- sv_2mortal(newSVpv("+utf8::IsAlpha\n+utf8::IsDigit\n005F\n",0)), 0, 0);
- return swash_fetch(PL_utf8_alnum, p, TRUE) != 0;
-#endif
+ /* NOTE: "IsWord", not "IsAlnum", since Alnum is a true
+ * descendant of isalnum(3), in other words, it doesn't
+ * contain the '_'. --jhi */
+ return S_is_utf8_common(aTHX_ p, &PL_utf8_alnum, "IsWord");
}
bool
Perl_is_utf8_alnumc(pTHX_ const U8 *p)
{
- if (!is_utf8_char(p))
- return FALSE;
- if (!PL_utf8_alnumc)
- PL_utf8_alnumc = swash_init("utf8", "IsAlnumC", &PL_sv_undef, 0, 0);
- return swash_fetch(PL_utf8_alnumc, p, TRUE) != 0;
-/* return is_utf8_alpha(p) || is_utf8_digit(p); */
-#ifdef SURPRISINGLY_SLOWER /* probably because alpha is usually true */
- if (!PL_utf8_alnum)
- PL_utf8_alnum = swash_init("utf8", "",
- sv_2mortal(newSVpv("+utf8::IsAlpha\n+utf8::IsDigit\n005F\n",0)), 0, 0);
- return swash_fetch(PL_utf8_alnum, p, TRUE) != 0;
-#endif
+ return S_is_utf8_common(aTHX_ p, &PL_utf8_alnumc, "IsAlnumC");
}
bool