/* Grammar reduction for Bison.
- Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
{
int useful = 0;
int useless = nrules - nuseless_productions;
- rule *rules_sorted = MALLOC (rules_sorted, nrules);
+ rule *rules_sorted = xnmalloc (nrules, sizeof *rules_sorted);
rule_number r;
for (r = 0; r < nrules; ++r)
rules_sorted[rules[r].useful ? useful++ : useless++] = rules[r];
/* Adjust NRITEMS. */
{
- int r;
+ rule_number r;
int length;
for (r = nrules; r < nrules + nuseless_productions; ++r)
{
/* Map the nonterminals to their new index: useful first, useless
afterwards. Kept for later report. */
- symbol_number *nontermmap = CALLOC (nontermmap, nvars);
+ symbol_number *nontermmap = xnmalloc (nvars, sizeof *nontermmap);
n = ntokens;
for (i = ntokens; i < nsyms; i++)
if (bitset_test (V, i))
/* Shuffle elements of tables indexed by symbol number. */
{
- symbol **symbols_sorted = MALLOC (symbols_sorted, nvars);
+ symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted);
for (i = ntokens; i < nsyms; i++)
symbols[i]->number = nontermmap[i - ntokens];