bison-patches
[Top][All Lists]
Advanced

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

[PATCH 3/4] style: reduce scopes, propagate const


From: Akim Demaille
Subject: [PATCH 3/4] style: reduce scopes, propagate const
Date: Thu, 13 Jun 2019 07:06:09 +0200

* src/conflicts.c (conflicts_output): here.
---
 src/conflicts.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/conflicts.c b/src/conflicts.c
index fd7431e2..fbff4cff 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -431,7 +431,7 @@ conflicts_update_state_numbers (state_number old_to_new[],
 `---------------------------------------------*/
 
 static size_t
-count_state_sr_conflicts (state *s)
+count_state_sr_conflicts (const state *s)
 {
   transitions *trans = s->transitions;
   reductions *reds = s->reductions;
@@ -479,7 +479,7 @@ count_sr_conflicts (void)
 `-----------------------------------------------------------------*/
 
 static size_t
-count_state_rr_conflicts (state *s)
+count_state_rr_conflicts (const state *s)
 {
   reductions *reds = s->reductions;
   size_t res = 0;
@@ -591,10 +591,9 @@ conflicts_output (FILE *out)
 {
   bool printed_sth = false;
   for (state_number i = 0; i < nstates; ++i)
-    {
-      state *s = states[i];
     if (conflicts[i])
       {
+        const state *s = states[i];
         int src = count_state_sr_conflicts (s);
         int rrc = count_state_rr_conflicts (s);
         fprintf (out, _("State %d "), i);
@@ -608,8 +607,6 @@ conflicts_output (FILE *out)
           fprintf (out, _("conflicts: %d reduce/reduce\n"), rrc);
         printed_sth = true;
       }
-    }
   if (printed_sth)
     fputs ("\n\n", out);
 }
-- 
2.21.0




reply via email to

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