From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Thu, 27 Jun 2002 19:12:46 +0000 (+0000)
Subject: Shave off some more of the Unicode regex slowness.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b11f357e172c58160ed5ae754def443bbae9bacb;p=p5sagit%2Fp5-mst-13.2.git

Shave off some more of the Unicode regex slowness.

p4raw-id: //depot/perl@17371
---

diff --git a/regexec.c b/regexec.c
index 0c45fd0..f196cb7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -4284,15 +4284,16 @@ Perl_regclass_swash(pTHX_ register regnode* node, bool doinit, SV** listsvp, SV
 	if (PL_regdata->what[n] == 's') {
 	    SV *rv = (SV*)PL_regdata->data[n];
 	    AV *av = (AV*)SvRV((SV*)rv);
+	    SV **ary = AvARRAY(av);
 	    SV **a, **b;
 	
 	    /* See the end of regcomp.c:S_reglass() for
 	     * documentation of these array elements. */
 
-	    si  = *av_fetch(av, 0, FALSE);
-	    a   =  av_fetch(av, 1, FALSE);
-	    b   =  av_fetch(av, 2, FALSE);
-	
+	    si = *ary;
+	    a  = SvTYPE(ary[1]) == SVt_RV   ? &ary[1] : 0;
+	    b  = SvTYPE(ary[2]) == SVt_PVAV ? &ary[2] : 0;
+
 	    if (a)
 		sw = *a;
 	    else if (si && doinit) {