summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-05-13 09:47:11 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-05-13 09:47:11 +0000
commit190b87bbb2dffc7632c53f69dcad3d0e5a1dad46 (patch)
treeab127484971fa5731259a6d386ac1b6ccfc334cb /regexec.c
parente6db53b3fb2c19da8c325c23f0fc1e8466c3c06f (diff)
downloadperl-190b87bbb2dffc7632c53f69dcad3d0e5a1dad46.tar.gz
[win32] merge change#664 from maint branch
p4raw-link: @664 on //depot/maint-5.004/perl: c3ae1fa52acf9130fcc1770ad2fce8519766b744 p4raw-id: //depot/win32/perl@926
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/regexec.c b/regexec.c
index 250704c228..a9f2751cda 100644
--- a/regexec.c
+++ b/regexec.c
@@ -114,9 +114,11 @@ static I32 regmatch _((regnode *prog));
static I32 regrepeat _((regnode *p, I32 max));
static I32 regrepeat_hard _((regnode *p, I32 max, I32 *lp));
static I32 regtry _((regexp *prog, char *startpos));
+
static bool reginclass _((char *p, I32 c));
static CHECKPOINT regcppush _((I32 parenfloor));
static char * regcppop _((void));
+#define REGINCLASS(p,c) (*(p) ? reginclass(p,c) : ANYOF_TEST(p,c))
static CHECKPOINT
regcppush(I32 parenfloor)
@@ -422,7 +424,7 @@ regexec_flags(register regexp *prog, char *stringarg, register char *strend, cha
case ANYOF:
Class = (char *) OPERAND(c);
while (s < strend) {
- if (reginclass(Class, *s)) {
+ if (REGINCLASS(Class, *s)) {
if (tmp && regtry(prog, s))
goto got_it;
else
@@ -890,7 +892,7 @@ regmatch(regnode *prog)
s = (char *) OPERAND(scan);
if (nextchar < 0)
nextchar = UCHARAT(locinput);
- if (!reginclass(s, nextchar))
+ if (!REGINCLASS(s, nextchar))
sayNO;
if (!nextchar && locinput >= regeol)
sayNO;
@@ -1663,7 +1665,7 @@ regrepeat(regnode *p, I32 max)
scan++;
break;
case ANYOF:
- while (scan < loceol && reginclass(opnd, *scan))
+ while (scan < loceol && REGINCLASS(opnd, *scan))
scan++;
break;
case ALNUM:
@@ -1774,7 +1776,7 @@ reginclass(register char *p, register I32 c)
bool match = FALSE;
c &= 0xFF;
- if (p[1 + (c >> 3)] & (1 << (c & 7)))
+ if (ANYOF_TEST(p, c))
match = TRUE;
else if (flags & ANYOF_FOLD) {
I32 cf;
@@ -1784,7 +1786,7 @@ reginclass(register char *p, register I32 c)
}
else
cf = fold[c];
- if (p[1 + (cf >> 3)] & (1 << (cf & 7)))
+ if (ANYOF_TEST(p, cf))
match = TRUE;
}
@@ -1800,7 +1802,7 @@ reginclass(register char *p, register I32 c)
}
}
- return match ^ ((flags & ANYOF_INVERT) != 0);
+ return (flags & ANYOF_INVERT) ? !match : match;
}