diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-02-14 19:53:28 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-02-14 19:53:42 -0500 |
commit | 2dd6733108f2bea07b0a3469e768bd900c0808b3 (patch) | |
tree | 6b9d7faf0edf3c1ccbb6fc3f959434e5931aa856 /src/backend/regex/regcomp.c | |
parent | c7ecd6af010e2ac8c5530f3985e97f24531bfa5f (diff) | |
download | postgresql-2dd6733108f2bea07b0a3469e768bd900c0808b3.tar.gz postgresql-2dd6733108f2bea07b0a3469e768bd900c0808b3.zip |
Minor fixes to improve regex debugging code.
When REG_DEBUG is defined, ensure that an un-filled "struct cnfa"
is all-zeroes, not just that it has nstates == 0. This is mainly
so that looking at "struct subre" structs in gdb doesn't distract
one with a lot of garbage fields during regex compilation.
Adjust some places that print debug output to have suitable fflush
calls afterwards.
In passing, correct an erroneous ancient comment: the concatenation
subre-s created by parsebranch() have op == '.' not ','.
Noted while fooling around with some regex performance improvements.
Diffstat (limited to 'src/backend/regex/regcomp.c')
-rw-r--r-- | src/backend/regex/regcomp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index 91078dcd806..f0896d2db14 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -479,7 +479,10 @@ pg_regcomp(regex_t *re, #ifdef REG_DEBUG if (flags & REG_DUMP) + { dump(re, stdout); + fflush(stdout); + } #endif assert(v->err == 0); @@ -721,7 +724,7 @@ parse(struct vars *v, * * This mostly manages concatenation, working closely with parseqatom(). * Concatenated things are bundled up as much as possible, with separate - * ',' nodes introduced only when necessary due to substructure. + * '.' nodes introduced only when necessary due to substructure. */ static struct subre * parsebranch(struct vars *v, |