bison-patches
[Top][All Lists]
Advanced

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

graphviz: move constant computation out of a loop


From: Akim Demaille
Subject: graphviz: move constant computation out of a loop
Date: Sun, 21 Apr 2019 16:46:51 +0200

commit 341776b03b921b7dfd508329b8d891cac08a63af
Author: Akim Demaille <address@hidden>
Date:   Sun Mar 31 14:30:44 2019 +0200

    graphviz: move constant computation out of a loop
    
    * src/graphviz.c (output_red): here.

diff --git a/src/graphviz.c b/src/graphviz.c
index 75e4a6e6..4a826cb3 100644
--- a/src/graphviz.c
+++ b/src/graphviz.c
@@ -159,6 +159,9 @@ output_red (state const *s, reductions const *reds, FILE 
*fout)
   bitset no_reduce_set;
   no_reduce_bitset_init (s, &no_reduce_set);
 
+  rule *default_reduction
+    = yydefact[s->number] ? &rules[yydefact[s->number] - 1] : NULL;
+
   /* Two obstacks are needed: one for the enabled reductions, and one
      for the disabled reductions, because in the end we want two
      separate edges, even though in most cases only one will actually
@@ -171,11 +174,6 @@ output_red (state const *s, reductions const *reds, FILE 
*fout)
   const int source = s->number;
   for (int j = 0; j < reds->num; ++j)
     {
-      rule *default_reduction =
-        yydefact[s->number]
-        ? &rules[yydefact[s->number] - 1]
-        : NULL;
-
       bool defaulted = default_reduction && default_reduction == 
reds->rules[j];
 
       /* Build the lookahead tokens lists, one for enabled transitions




reply via email to

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