mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
Fix some memory leaks, and fix a bug: state 0 was examined twice.
* src/LR0.c (new_state): Merge into... (state_list_append): this. (new_states): Merge into... (generate_states): here. (set_states): Don't ensure a proper `errs' state member here, do it... * src/conflicts.c (conflicts_solve): here. * src/state.h, src/state.c: Comment changes. (state_t): Rename member `shifts' as `transitions'. Adjust all dependencies. (errs_new): For consistency, also take the values as argument. (errs_dup): Remove. (state_errs_set): New. (state_reductions_set, state_transitions_set): Assert that no previous value was assigned. (state_free): New. (states_free): Use it. * src/conflicts.c (resolve_sr_conflict): Don't use an `errs_t' as temporary storage: use `errs' and `nerrs' as elsewhere. (set_conflicts): Allocate and free this `errs'.
This commit is contained in:
@@ -125,7 +125,7 @@ print_core (FILE *out, state_t *state)
|
||||
static void
|
||||
print_transitions (state_t *state, FILE *out, bool display_transitions_p)
|
||||
{
|
||||
transitions_t *transitions = state->shifts;
|
||||
transitions_t *transitions = state->transitions;
|
||||
size_t width = 0;
|
||||
int i;
|
||||
|
||||
@@ -224,7 +224,7 @@ state_default_rule (state_t *state)
|
||||
we shift (S/R conflicts)... */
|
||||
bitset_zero (shiftset);
|
||||
{
|
||||
transitions_t *transitions = state->shifts;
|
||||
transitions_t *transitions = state->transitions;
|
||||
for (i = 0; i < transitions->num && TRANSITION_IS_SHIFT (transitions, i); i++)
|
||||
if (!TRANSITION_IS_DISABLED (transitions, i))
|
||||
{
|
||||
@@ -302,7 +302,7 @@ print_reduction (FILE *out, size_t width,
|
||||
static void
|
||||
print_reductions (FILE *out, state_t *state)
|
||||
{
|
||||
transitions_t *transitions = state->shifts;
|
||||
transitions_t *transitions = state->transitions;
|
||||
reductions_t *redp = state->reductions;
|
||||
rule_t *default_rule = NULL;
|
||||
size_t width = 0;
|
||||
@@ -396,7 +396,7 @@ static void
|
||||
print_actions (FILE *out, state_t *state)
|
||||
{
|
||||
reductions_t *redp = state->reductions;
|
||||
transitions_t *transitions = state->shifts;
|
||||
transitions_t *transitions = state->transitions;
|
||||
|
||||
if (transitions->num == 0 && redp->num == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user