aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/re.c b/re.c
index 91cff4d6..a23e7f6c 100644
--- a/re.c
+++ b/re.c
@@ -438,9 +438,12 @@ re_update(NODE *t)
refree(t->re_reg[1]);
t->re_reg[1] = NULL;
}
- if (t->re_cnt > 0)
- t->re_cnt++;
- if (t->re_cnt > 10)
+ if (t->re_cnt > 0 && ++t->re_cnt > 10)
+ /*
+ * The regex appears to update frequently, so disable DFA
+ * matching (which trades off expensive upfront compilation
+ * overhead for faster subsequent matching).
+ */
t->re_cnt = 0;
if (t->re_text == NULL) {
/* reset regexp text if needed */