aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-11-03 20:34:25 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-11-03 20:34:25 +0200
commitc9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3 (patch)
treeb0d66bbd999fad91ae1025224fea17755d6ecc4d /re.c
parentc5227d1685aa158e63d4b6a6289063ae985673c1 (diff)
downloadegawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.tar.gz
egawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.tar.bz2
egawk-c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3.zip
Use dfa superset to speed up matching.
Diffstat (limited to 're.c')
-rw-r--r--re.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/re.c b/re.c
index 9118129e..12c212a6 100644
--- a/re.c
+++ b/re.c
@@ -284,13 +284,18 @@ research(Regexp *rp, char *str, int start,
if (rp->dfa && ! no_bol && ! need_start) {
char save;
size_t count = 0;
+ struct dfa *superset = dfasuperset(rp->dfareg);
/*
* dfa likes to stick a '\n' right after the matched
* text. So we just save and restore the character.
*/
save = str[start+len];
- ret = dfaexec(rp->dfareg, str+start, str+start+len, true,
- &count, &try_backref);
+ if (superset)
+ ret = dfaexec(superset, str+start, str+start+len,
+ true, NULL, NULL);
+ if (ret)
+ ret = dfaexec(rp->dfareg, str+start, str+start+len,
+ true, &count, &try_backref);
str[start+len] = save;
}