From 8dac7aaa475f205a4fe8ebfd27cd4c75775d6aef Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 14 Aug 2016 17:23:38 +0300 Subject: Speedup regexp compilation if not using dfa. --- re.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 're.c') diff --git a/re.c b/re.c index 5049bca6..8a325308 100644 --- a/re.c +++ b/re.c @@ -203,10 +203,14 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) syn &= ~RE_ICASE; } - dfa_syn = syn; - if (ignorecase) - dfa_syn |= RE_ICASE; - dfasyntax(dfa_syn, ignorecase, '\n'); + /* only call dfasyntax if we're using dfa; saves time */ + if (dfa && ! no_dfa) { + dfa_syn = syn; + /* FIXME: dfa doesn't pay attention RE_ICASE */ + if (ignorecase) + dfa_syn |= RE_ICASE; + dfasyntax(dfa_syn, ignorecase, '\n'); + } re_set_syntax(syn); if ((rerr = re_compile_pattern(buf, len, &(rp->pat))) != NULL) { -- cgit v1.2.3