mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +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:
@@ -2951,11 +2951,11 @@ carc_cmp(const void *a, const void *b)
|
||||
static void
|
||||
freecnfa(struct cnfa *cnfa)
|
||||
{
|
||||
assert(cnfa->nstates != 0); /* not empty already */
|
||||
cnfa->nstates = 0;
|
||||
assert(!NULLCNFA(*cnfa)); /* not empty already */
|
||||
FREE(cnfa->stflags);
|
||||
FREE(cnfa->states);
|
||||
FREE(cnfa->arcs);
|
||||
ZAPCNFA(*cnfa);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3012,13 +3012,13 @@ dumpstate(struct state *s,
|
||||
fprintf(f, "\tno out arcs\n");
|
||||
else
|
||||
dumparcs(s, f);
|
||||
fflush(f);
|
||||
for (a = s->ins; a != NULL; a = a->inchain)
|
||||
{
|
||||
if (a->to != s)
|
||||
fprintf(f, "\tlink from %d to %d on %d's in-chain\n",
|
||||
a->from->no, a->to->no, s->no);
|
||||
}
|
||||
fflush(f);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user