mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
grammar: free the association tracking graph
The graph introduced by Valentin wasn't free'd after use. * src/symtab.c (assoc_free): New, clear the array of linked lists with... (linkedlist_free): This, new. (print_precedence_warnings): Call assoc_free when done. (print_assoc_warnings): Free used_assoc after use.
This commit is contained in:
38
src/symtab.c
38
src/symtab.c
@@ -1057,6 +1057,42 @@ register_precedence (graphid first, graphid snd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------.
|
||||||
|
| Deep clear a linked / adjacency list). |
|
||||||
|
`---------------------------------------*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
linkedlist_free (symgraphlink *node)
|
||||||
|
{
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
while (node->next)
|
||||||
|
{
|
||||||
|
symgraphlink *tmp = node->next;
|
||||||
|
free (node);
|
||||||
|
node = tmp;
|
||||||
|
}
|
||||||
|
free (node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------.
|
||||||
|
| Clear and destroy association tracking table. |
|
||||||
|
`----------------------------------------------*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
assoc_free (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < nsyms; ++i)
|
||||||
|
{
|
||||||
|
linkedlist_free (prec_nodes[i]->pred);
|
||||||
|
linkedlist_free (prec_nodes[i]->succ);
|
||||||
|
free (prec_nodes[i]);
|
||||||
|
}
|
||||||
|
free (prec_nodes);
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------.
|
/*---------------------------------------.
|
||||||
| Initialize association tracking table. |
|
| Initialize association tracking table. |
|
||||||
`---------------------------------------*/
|
`---------------------------------------*/
|
||||||
@@ -1127,4 +1163,6 @@ print_precedence_warnings (void)
|
|||||||
complain (&s->location, Wprecedence,
|
complain (&s->location, Wprecedence,
|
||||||
_("useless associativity for %s, use %%precedence"), s->tag);
|
_("useless associativity for %s, use %%precedence"), s->tag);
|
||||||
}
|
}
|
||||||
|
free (used_assoc);
|
||||||
|
assoc_free ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user