diff options
author | stanton <stanton> | 1998-11-24 01:16:41 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-11-24 01:16:41 (GMT) |
commit | 9a335d2e41e9519c7a5f9bfc9dd1cffab8550a04 (patch) | |
tree | 0ee6d9e49ac7edea4b71650f36ad061b8eea8f57 /generic/regexec.c | |
parent | 21aa86543d6e0ee2be6f71c0ba9039863a1b01f0 (diff) | |
download | tcl-9a335d2e41e9519c7a5f9bfc9dd1cffab8550a04.zip tcl-9a335d2e41e9519c7a5f9bfc9dd1cffab8550a04.tar.gz tcl-9a335d2e41e9519c7a5f9bfc9dd1cffab8550a04.tar.bz2 |
* regexec.c: more performance tuning from Henry Spencer.
Diffstat (limited to 'generic/regexec.c')
-rw-r--r-- | generic/regexec.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/regexec.c b/generic/regexec.c index 50fcc70..088d12b 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -250,15 +250,20 @@ struct colormap *cm; close = shortest(v, s, close, close, v->stop, &open); if (close == NULL) break; /* NOTE BREAK */ + if (v->nmatch == 0) { + /* don't need exact location */ + freedfa(d); + freedfa(s); + return REG_OKAY; + } MDEBUG(("between %ld and %ld\n", LOFF(open), LOFF(close))); for (begin = open; begin <= close; begin++) { MDEBUG(("\nfind trying at %ld\n", LOFF(begin))); end = longest(v, d, begin, v->stop); if (end != NULL) { - if (v->nmatch > 0) { - v->pmatch[0].rm_so = OFF(begin); - v->pmatch[0].rm_eo = OFF(end); - } + assert(v->nmatch > 0); + v->pmatch[0].rm_so = OFF(begin); + v->pmatch[0].rm_eo = OFF(end); freedfa(d); freedfa(s); if (v->nmatch > 1) { |