bison-patches
[Top][All Lists]
Advanced

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

13-fyi-no-rule-reorder.patch


From: Akim Demaille
Subject: 13-fyi-no-rule-reorder.patch
Date: Sun, 07 Apr 2002 17:23:50 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        As a result of the previous patch, it is no longer needed
        to reorder ritem itself.

        * src/reduce.c (reduce_grammar_tables): Don't sort RITEM.

Index: src/reduce.c
--- src/reduce.c Mon, 25 Mar 2002 21:34:54 +0100 akim
+++ src/reduce.c Wed, 03 Apr 2002 22:59:32 +0200 akim
@@ -248,22 +248,14 @@
     free (rules + 1);
     rules = rules_sorted;

-    /* Also reorder ritems. */
-    {
-      short *ritems_sorted = XCALLOC (short, nitems + 1);
-      short *ritemsp = ritems_sorted;
-      for (i = 1; i < nrules + 1; ++i)
-       {
-         short *rhsp = rules[i].rhs;
-         rules[i].rhs = ritemsp;
-         for (/* Nothing. */; *rhsp >= 0; ++rhsp)
-           *ritemsp++ = *rhsp;
-         *ritemsp++ = -i;
-       }
-      *ritemsp++ = 0;
-      free (ritem);
-      ritem = ritems_sorted;
-    }
+    /* Renumber the rules markers in RITEMS.  */
+    for (i = 1; i < nrules + 1; ++i)
+      {
+       short *rhsp = rules[i].rhs;
+       for (/* Nothing. */; *rhsp >= 0; ++rhsp)
+         /* Nothing. */;
+       *rhsp = -i;
+      }
     nrules -= nuseless_productions;
   }



reply via email to

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