]> git.saurik.com Git - bison.git/blobdiff - src/tables.c
Update.
[bison.git] / src / tables.c
index 17bc5cd635ca19adee0d9603fbe4e73624fc074b..a615204a76777bf2514a6290ef963eab7e544c5a 100644 (file)
@@ -207,13 +207,12 @@ table_grow (size_t desired)
     table_size *= 2;
 
   if (trace_flag & trace_resource)
-    fprintf (stderr, _("growing table and check from: %lu to %lu\n"),
-            (unsigned long) old_size, (unsigned long) table_size);
+    fprintf (stderr, "growing table and check from: %d to %d\n",
+            old_size, table_size);
 
   table = XREALLOC (table, base_t, table_size);
   check = XREALLOC (check, base_t, table_size);
-  if (glr_parser)
-    conflict_table = XREALLOC (conflict_table, unsigned int, table_size);
+  conflict_table = XREALLOC (conflict_table, unsigned int, table_size);
 
   for (/* Nothing. */; old_size < table_size; ++old_size)
     {
@@ -470,27 +469,22 @@ token_actions (void)
   symbol_number_t j;
   rule_number_t r;
 
-  int nconflict = conflicts_total_count ();
+  int nconflict = glr_parser ? conflicts_total_count () : 0;
 
   yydefact = XCALLOC (rule_number_t, nstates);
 
   actrow = XCALLOC (action_t, ntokens);
   conflrow = XCALLOC (unsigned int, ntokens);
 
+  conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
+  conflict_list_free = 2 * nconflict;
+  conflict_list_cnt = 1;
+
   /* Find the rules which are reduced.  */
   if (!glr_parser)
     for (r = 0; r < nrules; ++r)
       rules[r].useful = FALSE;
 
-  if (glr_parser)
-    {
-      conflict_list = XCALLOC (unsigned int, 1 + 2 * nconflict);
-      conflict_list_free = 2 * nconflict;
-      conflict_list_cnt = 1;
-    }
-  else
-    conflict_list_free = conflict_list_cnt = 0;
-
   for (i = 0; i < nstates; ++i)
     {
       rule_t *default_rule = action_row (states[i]);
@@ -754,7 +748,7 @@ pack_vector (vector_number_t vector)
            high = loc;
 
          if (j < BASE_MIN || BASE_MAX < j)
-           fatal (_("base_t too small to hold %d\n"), j);
+           fatal ("base_t too small to hold %d\n", j);
          return j;
        }
     }
@@ -780,7 +774,7 @@ table_ninf_remap (base_t tab[], size_t size, base_t ninf)
 
   for (i = 0; i < size; i++)
     if (tab[i] < res && tab[i] != ninf)
-      res = base[i];
+      res = tab[i];
 
   --res;
 
@@ -799,8 +793,7 @@ pack_table (void)
   base = XCALLOC (base_t, nvectors);
   pos = XCALLOC (base_t, nentries);
   table = XCALLOC (base_t, table_size);
-  if (glr_parser)
-    conflict_table = XCALLOC (unsigned int, table_size);
+  conflict_table = XCALLOC (unsigned int, table_size);
   check = XCALLOC (base_t, table_size);
 
   lowzero = 0;