mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
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.
This commit is contained in:
@@ -368,7 +368,15 @@ struct cnfa
|
||||
struct carc *arcs; /* the area for the lists */
|
||||
};
|
||||
|
||||
/*
|
||||
* When debugging, it's helpful if an un-filled CNFA is all-zeroes.
|
||||
* In production, though, we only require nstates to be zero.
|
||||
*/
|
||||
#ifdef REG_DEBUG
|
||||
#define ZAPCNFA(cnfa) memset(&(cnfa), 0, sizeof(cnfa))
|
||||
#else
|
||||
#define ZAPCNFA(cnfa) ((cnfa).nstates = 0)
|
||||
#endif
|
||||
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user