aboutsummaryrefslogtreecommitdiff
path: root/src/libregexp
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2007-05-18 16:43:43 +0000
committerrsc <devnull@localhost>2007-05-18 16:43:43 +0000
commitda7f7882a2797fa3b6fbc9886e8a2144625739bb (patch)
treee53bea79defc5daf950676ac29587499367f2fa0 /src/libregexp
parentd91ab9ea7b4c0587b4ac5bcbddf091a269bd9213 (diff)
downloadplan9port-da7f7882a2797fa3b6fbc9886e8a2144625739bb.tar.gz
plan9port-da7f7882a2797fa3b6fbc9886e8a2144625739bb.tar.bz2
plan9port-da7f7882a2797fa3b6fbc9886e8a2144625739bb.zip
Match leading ^ in regexp with embedded newlines (Roger Peppe)
Diffstat (limited to 'src/libregexp')
-rw-r--r--src/libregexp/regexec.c2
-rw-r--r--src/libregexp/rregexec.c19
2 files changed, 10 insertions, 11 deletions
diff --git a/src/libregexp/regexec.c b/src/libregexp/regexec.c
index 62ab1a31..a00fbcbc 100644
--- a/src/libregexp/regexec.c
+++ b/src/libregexp/regexec.c
@@ -58,7 +58,7 @@ regexec1(Reprog *progp, /* program to run */
p = utfrune(s, '\n');
if(p == 0 || s == j->eol)
return match;
- s = p;
+ s = p+1;
break;
}
}
diff --git a/src/libregexp/rregexec.c b/src/libregexp/rregexec.c
index eece0eb9..4312c4f9 100644
--- a/src/libregexp/rregexec.c
+++ b/src/libregexp/rregexec.c
@@ -25,6 +25,7 @@ rregexec1(Reprog *progp, /* program to run */
Relist* tle; /* ends of this and next list */
Relist* nle;
int match;
+ Rune *p;
match = 0;
checkstart = j->startchar;
@@ -44,20 +45,18 @@ rregexec1(Reprog *progp, /* program to run */
if(checkstart) {
switch(j->starttype) {
case RUNE:
- while(*s != j->startchar) {
- if(*s == 0 || s == j->reol)
- return match;
- s++;
- }
+ p = runestrchr(s, j->startchar);
+ if(p == 0 || p == j->eol)
+ return match;
+ s = p;
break;
case BOL:
if(s == bol)
break;
- while(*s != '\n') {
- if(*s == 0 || s == j->reol)
- return match;
- s++;
- }
+ p = runestrchr(s, '\n');
+ if(p == 0 || s == j->reol)
+ return match;
+ s = p+1;
break;
}
}