summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-02-08 04:01:10 +0000
committerJim Meyering <jim@meyering.net>1994-02-08 04:01:10 +0000
commitf119c30bf320cdfaa08be8080946f8251a8c4e3f (patch)
treed53cac369b7fda91d11a41d9c684bf75d9182077 /src/regex.c
parent6cd877474760b5b21813a05ee5161c1d0553f21a (diff)
downloademacs-f119c30bf320cdfaa08be8080946f8251a8c4e3f.tar.gz
*** empty log message ***
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/regex.c b/src/regex.c
index e71961594ba..532d75330dc 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -3324,6 +3324,10 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
unsigned char *p = bufp->buffer;
register unsigned char *pend = p + bufp->used;
+ /* Mark the opcode just after a start_memory, so we can test for an
+ empty subpattern when we get to the stop_memory. */
+ unsigned char *just_past_start_mem = 0;
+
/* We use this to map every character in the string. */
char *translate = bufp->translate;
@@ -3804,6 +3808,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Move past the register number and inner group count. */
p += 2;
+ just_past_start_mem = p;
break;
@@ -3868,7 +3873,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
information for this group that we had before trying this
last match. */
if ((!MATCHED_SOMETHING (reg_info[*p])
- || (re_opcode_t) p[-3] == start_memory)
+ || just_past_start_mem == p - 1)
&& (p + 2) < pend)
{
boolean is_a_jump_n = false;