At the time of skeleton construction DFA has just been build and
all tags in it are just raw pointers to lists of commands. These
pointers are unique for each transition (tags are not shared between
transitions). This means, comparing tags for different transitions
will always result in 'not equal', except if both transitions have
no tags (pointers are NULLs).
Found by slyfox's fuzzer. ;)
, cmd(NULL)
{}
+static bool same(const tcmd_t &x, const tcmd_t &y)
+{
+ return x.save == y.save && x.copy == y.copy;
+}
+
void Node::init(const dfa_state_t *s, const charset_t &cs, size_t nil)
{
const size_t nc = cs.size() - 1;
size_t j = s->arcs[c];
const tcmd_t &t = s->tcmd[c];
- for (; ++c < nc && s->arcs[c] == j && !s->tcmd[c].save && !s->tcmd[c].copy;);
+ for (; ++c < nc && s->arcs[c] == j && same(s->tcmd[c], t););
if (j == dfa_t::NIL) j = nil;
// all arcs go to default node => this node is final