Simplify and document regex library's compact-NFA representation.
The previous coding abused the first element of a cNFA state's arcs list
to hold a per-state flag bit, which was confusing, undocumented, and not
even particularly efficient. Get rid of that in favor of a separate
"stflags" vector. Since there's only one bit in use, I chose to allocate a
char per state; we could possibly replace this with a bitmap at some point,
but that would make accesses a little slower. It's already about 8X
smaller than before, so let's not get overly tense.
Also document the representation better than it was before, which is to say
not at all.
This patch is a byproduct of investigations towards extracting a "fixed
prefix" string from the compact-NFA representation of regex patterns.
Might need to back-patch it if we decide to back-patch that fix, but for
now it's just code cleanup so I'll just put it in HEAD.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/c6aae3042be5249e672b731ebeb21875b5343010
Modified Files
--------------
src/backend/regex/regc_nfa.c | 34 +++++++++++++++++-----------------
src/backend/regex/regcomp.c | 2 +-
src/backend/regex/rege_dfa.c | 11 +++++------
src/include/regex/regguts.h | 29 +++++++++++++++++++++--------
4 files changed, 44 insertions(+), 32 deletions(-)