]> git.saurik.com Git - bison.git/blobdiff - src/LR0.c
(Improper handling of embedded actions and dollar(-N) in GLR parsers):
[bison.git] / src / LR0.c
index e991f43673aa345aa24bfc059847571b6df9a233..aeb597d8d710171bb914c98ab16c964c83281727 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -105,9 +105,9 @@ allocate_itemsets (void)
      Note that useless productions (hence useless nonterminals) are
      browsed too, hence we need to allocate room for _all_ the
      symbols.  */
-  int count = 0;
-  short int *symbol_count = xcalloc (nsyms + nuseless_nonterminals,
-                                    sizeof *symbol_count);
+  size_t count = 0;
+  size_t *symbol_count = xcalloc (nsyms + nuseless_nonterminals,
+                                 sizeof *symbol_count);
 
   for (r = 0; r < nrules; ++r)
     for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
@@ -178,13 +178,12 @@ free_storage (void)
 static void
 new_itemsets (state *s)
 {
-  int i;
+  size_t i;
 
   if (trace_flag & trace_automaton)
     fprintf (stderr, "Entering new_itemsets, state = %d\n", s->number);
 
-  for (i = 0; i < nsyms; i++)
-    kernel_size[i] = 0;
+  memset (kernel_size, 0, nsyms * sizeof *kernel_size);
 
   nshifts = 0;
 
@@ -274,7 +273,7 @@ static void
 save_reductions (state *s)
 {
   int count = 0;
-  int i;
+  size_t i;
 
   /* Find and count the active items that represent ends of rules. */
   for (i = 0; i < nritemset; ++i)