mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
All uses of XCALLOC, XMALLOC, and XREALLOC changed to use new macros
CALLOC, MALLOC, REALLOC. All uses of XFREE changed to free.
This commit is contained in:
22
src/LR0.c
22
src/LR0.c
@@ -1,4 +1,4 @@
|
|||||||
/* Generate the nondeterministic finite state machine for bison,
|
/* Generate the nondeterministic finite state machine for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002 Free Software
|
Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
@@ -59,7 +59,7 @@ static state_list *last_state = NULL;
|
|||||||
static state *
|
static state *
|
||||||
state_list_append (symbol_number sym, size_t core_size, item_number *core)
|
state_list_append (symbol_number sym, size_t core_size, item_number *core)
|
||||||
{
|
{
|
||||||
state_list *node = XMALLOC (state_list, 1);
|
state_list *node = MALLOC (node, 1);
|
||||||
state *s = state_new (sym, core_size, core);
|
state *s = state_new (sym, core_size, core);
|
||||||
|
|
||||||
if (trace_flag & trace_automaton)
|
if (trace_flag & trace_automaton)
|
||||||
@@ -106,7 +106,7 @@ allocate_itemsets (void)
|
|||||||
browsed too, hence we need to allocate room for _all_ the
|
browsed too, hence we need to allocate room for _all_ the
|
||||||
symbols. */
|
symbols. */
|
||||||
int count = 0;
|
int count = 0;
|
||||||
short *symbol_count = XCALLOC (short, nsyms + nuseless_nonterminals);
|
short *symbol_count = CALLOC (symbol_count, nsyms + nuseless_nonterminals);
|
||||||
|
|
||||||
for (r = 0; r < nrules; ++r)
|
for (r = 0; r < nrules; ++r)
|
||||||
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
|
for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
|
||||||
@@ -121,9 +121,9 @@ allocate_itemsets (void)
|
|||||||
appears as an item, which is SYMBOL_COUNT[S].
|
appears as an item, which is SYMBOL_COUNT[S].
|
||||||
We allocate that much space for each symbol. */
|
We allocate that much space for each symbol. */
|
||||||
|
|
||||||
kernel_base = XCALLOC (item_number *, nsyms);
|
CALLOC (kernel_base, nsyms);
|
||||||
if (count)
|
if (count)
|
||||||
kernel_items = XCALLOC (item_number, count);
|
CALLOC (kernel_items, count);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < nsyms; i++)
|
for (i = 0; i < nsyms; i++)
|
||||||
@@ -133,7 +133,7 @@ allocate_itemsets (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free (symbol_count);
|
free (symbol_count);
|
||||||
kernel_size = XCALLOC (int, nsyms);
|
CALLOC (kernel_size, nsyms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,10 +142,10 @@ allocate_storage (void)
|
|||||||
{
|
{
|
||||||
allocate_itemsets ();
|
allocate_itemsets ();
|
||||||
|
|
||||||
shiftset = XCALLOC (state *, nsyms);
|
CALLOC (shiftset, nsyms);
|
||||||
redset = XCALLOC (rule *, nrules);
|
CALLOC (redset, nrules);
|
||||||
state_hash_new ();
|
state_hash_new ();
|
||||||
shift_symbol = XCALLOC (symbol_number, nsyms);
|
CALLOC (shift_symbol, nsyms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ free_storage (void)
|
|||||||
free (shiftset);
|
free (shiftset);
|
||||||
free (kernel_base);
|
free (kernel_base);
|
||||||
free (kernel_size);
|
free (kernel_size);
|
||||||
XFREE (kernel_items);
|
free (kernel_items);
|
||||||
state_hash_free ();
|
state_hash_free ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ save_reductions (state *s)
|
|||||||
static void
|
static void
|
||||||
set_states (void)
|
set_states (void)
|
||||||
{
|
{
|
||||||
states = XCALLOC (state *, nstates);
|
CALLOC (states, nstates);
|
||||||
|
|
||||||
while (first_state)
|
while (first_state)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -304,9 +304,9 @@ conflicts_solve (void)
|
|||||||
{
|
{
|
||||||
state_number i;
|
state_number i;
|
||||||
/* List of lookaheads on which we explicitly raise a syntax error. */
|
/* List of lookaheads on which we explicitly raise a syntax error. */
|
||||||
symbol **errors = XMALLOC (symbol *, ntokens + 1);
|
symbol **errors = MALLOC (errors, ntokens + 1);
|
||||||
|
|
||||||
conflicts = XCALLOC (char, nstates);
|
CALLOC (conflicts, nstates);
|
||||||
shiftset = bitset_create (ntokens, BITSET_FIXED);
|
shiftset = bitset_create (ntokens, BITSET_FIXED);
|
||||||
lookaheadset = bitset_create (ntokens, BITSET_FIXED);
|
lookaheadset = bitset_create (ntokens, BITSET_FIXED);
|
||||||
obstack_init (&solved_conflicts_obstack);
|
obstack_init (&solved_conflicts_obstack);
|
||||||
@@ -545,7 +545,7 @@ conflicts_print (void)
|
|||||||
void
|
void
|
||||||
conflicts_free (void)
|
conflicts_free (void)
|
||||||
{
|
{
|
||||||
XFREE (conflicts);
|
free (conflicts);
|
||||||
bitset_free (shiftset);
|
bitset_free (shiftset);
|
||||||
bitset_free (lookaheadset);
|
bitset_free (lookaheadset);
|
||||||
obstack_free (&solved_conflicts_obstack, NULL);
|
obstack_free (&solved_conflicts_obstack, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user