Change regexp engine's ccondissect/crevdissect routines to perform DFA
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 1 Feb 2010 02:45:55 +0000 (02:45 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 1 Feb 2010 02:45:55 +0000 (02:45 +0000)
commitf54f9ea1c62cdc0a0aedcbe59f66fbabbb58046c
tree13a8b5751246872610f7f3f3a5faf809edb9103a
parentd86bd9a826b1ab4aee7ac12e22105abca7af20ca
Change regexp engine's ccondissect/crevdissect routines to perform DFA
matching before recursing instead of after.  The DFA match eliminates
unworkable midpoint choices a lot faster than the recursive check, in most
cases, so doing it first can speed things up; particularly in pathological
cases such as recently exhibited by Michael Glaesemann.

In addition, apply some cosmetic changes that were applied upstream (in the
Tcl project) at the same time, in order to sync with upstream version 1.15
of regexec.c.

Upstream apparently intends to backpatch this, so I will too.  The
pathological behavior could be unpleasant if encountered in the field,
which seems to justify any risk of introducing new bugs.

Tom Lane, reviewed by Donal K. Fellows of Tcl project
src/backend/regex/regexec.c