style: scope reduction in lalr.c

* src/lalr.c (initialize_goto_follows): here.
This commit is contained in:
Akim Demaille
2019-04-12 08:30:15 +02:00
parent 2ab70cf0c6
commit d67b7daa1d

View File

@@ -199,7 +199,6 @@ initialize_goto_follows (void)
{ {
goto_number **reads = xnmalloc (ngotos, sizeof *reads); goto_number **reads = xnmalloc (ngotos, sizeof *reads);
goto_number *edge = xnmalloc (ngotos, sizeof *edge); goto_number *edge = xnmalloc (ngotos, sizeof *edge);
goto_number nedges = 0;
goto_follows = bitsetv_create (ngotos, ntokens, BITSET_FIXED); goto_follows = bitsetv_create (ngotos, ntokens, BITSET_FIXED);
@@ -212,6 +211,8 @@ initialize_goto_follows (void)
FOR_EACH_SHIFT (trans, j) FOR_EACH_SHIFT (trans, j)
bitset_set (goto_follows[i], TRANSITION_SYMBOL (trans, j)); bitset_set (goto_follows[i], TRANSITION_SYMBOL (trans, j));
/* Gotos outgoing from DST. */
goto_number nedges = 0;
for (; j < trans->num; ++j) for (; j < trans->num; ++j)
{ {
symbol_number sym = TRANSITION_SYMBOL (trans, j); symbol_number sym = TRANSITION_SYMBOL (trans, j);
@@ -229,7 +230,6 @@ initialize_goto_follows (void)
reads[i] = xnmalloc (nedges + 1, sizeof reads[i][0]); reads[i] = xnmalloc (nedges + 1, sizeof reads[i][0]);
memcpy (reads[i], edge, nedges * sizeof edge[0]); memcpy (reads[i], edge, nedges * sizeof edge[0]);
reads[i][nedges] = END_NODE; reads[i][nedges] = END_NODE;
nedges = 0;
} }
} }
if (trace_flag & trace_automaton) if (trace_flag & trace_automaton)