Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e59d3f8

Browse files
committed
Small bugfixes for broken old style use of the syntax table. AMK, of
course.
1 parent f259a8e commit e59d3f8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Modules/regexpr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,15 @@ static void re_compile_fastmap_aux(code,
611611
{
612612
syntaxcode = code[pos++];
613613
for (a = 0; a < 256; a++)
614-
if (SYNTAX(a) == syntaxcode)
614+
if (SYNTAX(a) & syntaxcode)
615615
fastmap[a] = 1;
616616
return;
617617
}
618618
case Cnotsyntaxspec:
619619
{
620620
syntaxcode = code[pos++];
621621
for (a = 0; a < 256; a++)
622-
if (SYNTAX(a) != syntaxcode)
622+
if (!(SYNTAX(a) & syntaxcode) )
623623
fastmap[a] = 1;
624624
return;
625625
}
@@ -1866,12 +1866,12 @@ int re_match(bufp,
18661866
if (translate)
18671867
{
18681868
while (text < textend &&
1869-
translate[SYNTAX(*text)] == a)
1869+
(SYNTAX(translate[*text]) & a) )
18701870
text++;
18711871
}
18721872
else
18731873
{
1874-
while (text < textend && SYNTAX(*text) == a)
1874+
while (text < textend && (SYNTAX(*text) & a) )
18751875
text++;
18761876
}
18771877
break;
@@ -1882,12 +1882,12 @@ int re_match(bufp,
18821882
if (translate)
18831883
{
18841884
while (text < textend &&
1885-
translate[SYNTAX(*text)] != a)
1885+
!(SYNTAX(translate[*text]) & a) )
18861886
text++;
18871887
}
18881888
else
18891889
{
1890-
while (text < textend && SYNTAX(*text) != a)
1890+
while (text < textend && !(SYNTAX(*text) & a) )
18911891
text++;
18921892
}
18931893
break;

0 commit comments

Comments
 (0)