bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02-fyi-formatting-output.patch


From: Akim Demaille
Subject: 02-fyi-formatting-output.patch
Date: Mon, 17 Dec 2001 18:20:41 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * src/output.c: Various formatting changes.
        
        
Index: src/output.c
--- src/output.c Sun, 16 Dec 2001 11:40:41 +0100 akim
+++ src/output.c Sun, 16 Dec 2001 11:57:47 +0100 akim
@@ -197,7 +197,7 @@
 
     XFREE (yyrhs);
   }
-  
+
 #if 0
   if (!semantic_parser)
     obstack_sgrow (&table_obstack, "\n#endif\n");
@@ -310,7 +310,6 @@
 {
   int i;
   int j;
-  int k;
   int m = 0;
   int n = 0;
   int default_rule;
@@ -380,15 +379,11 @@
   errp = state_table[state]->errs;
 
   if (errp)
-    {
-      k = errp->nerrs;
-
-      for (i = 0; i < k; i++)
-       {
-         symbol = errp->errs[i];
-         actrow[symbol] = MINSHORT;
-       }
-    }
+    for (i = 0; i < errp->nerrs; i++)
+      {
+       symbol = errp->errs[i];
+       actrow[symbol] = MINSHORT;
+      }
 
   /* Now find the most common reduction and make it the default action
      for this state.  */
@@ -459,10 +454,8 @@
 
   count = 0;
   for (i = 0; i < ntokens; i++)
-    {
-      if (actrow[i] != 0)
-       count++;
-    }
+    if (actrow[i] != 0)
+      count++;
 
   if (count == 0)
     return;
@@ -471,13 +464,11 @@
   tos[state] = sp2 = XCALLOC (short, count);
 
   for (i = 0; i < ntokens; i++)
-    {
-      if (actrow[i] != 0)
-       {
-         *sp1++ = i;
-         *sp2++ = actrow[i];
-       }
-    }
+    if (actrow[i] != 0)
+      {
+       *sp1++ = i;
+       *sp2++ = actrow[i];
+      }
 
   tally[state] = count;
   width[state] = sp1[-1] - sp[0] + 1;
@@ -557,10 +548,8 @@
 
   count = 0;
   for (i = begin; i < end; i++)
-    {
-      if (to_state[i] != default_state)
-       count++;
-    }
+    if (to_state[i] != default_state)
+      count++;
 
   if (count == 0)
     return;
@@ -571,13 +560,11 @@
   tos[symno] = sp2 = XCALLOC (short, count);
 
   for (i = begin; i < end; i++)
-    {
-      if (to_state[i] != default_state)
-       {
-         *sp1++ = from_state[i];
-         *sp2++ = to_state[i];
-       }
-    }
+    if (to_state[i] != default_state)
+      {
+       *sp1++ = from_state[i];
+       *sp2++ = to_state[i];
+      }
 
   tally[symno] = count;
   width[symno] = sp1[-1] - sp[0] + 1;
@@ -608,13 +595,11 @@
   default_state = -1;
 
   for (i = 0; i < nstates; i++)
-    {
-      if (state_count[i] > max)
-       {
-         max = state_count[i];
-         default_state = i;
-       }
-    }
+    if (state_count[i] > max)
+      {
+       max = state_count[i];
+       default_state = i;
+      }
 
   return default_state;
 }
@@ -668,26 +653,24 @@
   nentries = 0;
 
   for (i = 0; i < nvectors; i++)
-    {
-      if (tally[i] > 0)
-       {
-         t = tally[i];
-         w = width[i];
-         j = nentries - 1;
+    if (tally[i] > 0)
+      {
+       t = tally[i];
+       w = width[i];
+       j = nentries - 1;
 
-         while (j >= 0 && (width[order[j]] < w))
-           j--;
+       while (j >= 0 && (width[order[j]] < w))
+         j--;
 
-         while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t))
-           j--;
+       while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t))
+         j--;
 
-         for (k = nentries - 1; k > j; k--)
-           order[k + 1] = order[k];
+       for (k = nentries - 1; k > j; k--)
+         order[k + 1] = order[k];
 
-         order[j + 1] = i;
-         nentries++;
-       }
-    }
+       order[j + 1] = i;
+       nentries++;
+      }
 }
 
 
@@ -717,10 +700,8 @@
 
       match = 1;
       for (k = 0; match && k < t; k++)
-       {
-         if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k])
-           match = 0;
-       }
+       if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k])
+         match = 0;
 
       if (match)
        return j;
@@ -765,10 +746,8 @@
        }
 
       for (k = 0; ok && k < vector; k++)
-       {
-         if (pos[k] == j)
-           ok = 0;
-       }
+       if (pos[k] == j)
+         ok = 0;
 
       if (ok)
        {
@@ -830,10 +809,8 @@
 
   for (i = 0; i < nvectors; i++)
     {
-      if (froms[i])
-       XFREE (froms[i]);
-      if (tos[i])
-       XFREE (tos[i]);
+      XFREE (froms[i]);
+      XFREE (tos[i]);
     }
 
   XFREE (froms);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]