summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-17 21:50:26 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-17 21:50:26 +0000
commit7d3e948e24bb3d2cd32830e4d6a913f9068a0d8c (patch)
tree29f7dc7820ded152f31f836dbb60a7c004c79aa2 /regexec.c
parentc38200a5ad52955b71a17f21a895f95d47b5281e (diff)
downloadperl-7d3e948e24bb3d2cd32830e4d6a913f9068a0d8c.tar.gz
Simple speed gainback (as it was in 5.6): for non-Unicode
character classes use inlined macros instead of the full function call. p4raw-id: //depot/perl@15276
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/regexec.c b/regexec.c
index f620a3485d..9264b8639a 100644
--- a/regexec.c
+++ b/regexec.c
@@ -96,6 +96,8 @@
#define STATIC static
#endif
+#define REGINCLASS(p,c) (ANYOF_FLAGS(p) ? reginclasslen(p,c,0,0) : ANYOF_BITMAP_TEST(p,*(c)))
+
/*
* Forwards.
*/
@@ -921,9 +923,11 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
switch (OP(c)) {
case ANYOF:
while (s < strend) {
- STRLEN skip = do_utf8 ? UTF8SKIP(s) : 1;
-
- if (reginclass(c, (U8*)s, do_utf8) ||
+ STRLEN skip = do_utf8 ? UTF8SKIP(s) : 1;
+
+ if (do_utf8 ?
+ reginclasslen(c, (U8*)s, 0, do_utf8) :
+ REGINCLASS(c, (U8*)s) ||
(ANYOF_FOLD_SHARP_S(c, s, strend) &&
/* The assignment of 2 is intentional:
* for the sharp s, the skip is 2. */
@@ -935,7 +939,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta
tmp = doevery;
}
else
- tmp = 1;
+ tmp = 1;
s += skip;
}
break;
@@ -2432,7 +2436,7 @@ S_regmatch(pTHX_ regnode *prog)
else {
if (nextchr < 0)
nextchr = UCHARAT(locinput);
- if (!reginclass(scan, (U8*)locinput, do_utf8))
+ if (!REGINCLASS(scan, (U8*)locinput))
sayNO_ANYOF;
if (!nextchr && locinput >= PL_regeol)
sayNO;
@@ -3950,12 +3954,12 @@ S_regrepeat(pTHX_ regnode *p, I32 max)
if (do_utf8) {
loceol = PL_regeol;
while (hardcount < max && scan < loceol &&
- reginclass(p, (U8*)scan, do_utf8)) {
+ reginclasslen(p, (U8*)scan, 0, do_utf8)) {
scan += UTF8SKIP(scan);
hardcount++;
}
} else {
- while (scan < loceol && reginclass(p, (U8*)scan, do_utf8))
+ while (scan < loceol && REGINCLASS(p, (U8*)scan))
scan++;
}
break;