diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | re.c | 9 |
2 files changed, 9 insertions, 4 deletions
@@ -1,6 +1,8 @@ 2019-08-23 Arnold D. Robbins <arnold@skeeve.com> - * main.c: Fix whitespace issues. + * main.c (main): Fix whitespace issues. + * re.c (re_update): Small code cleanup in handling t->re_cnt. + Thanks to Andrew Schorr. 2019-08-21 Arnold D. Robbins <arnold@skeeve.com> @@ -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 */ |