bison-patches
[Top][All Lists]
Advanced

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

style: prefer bool to char


From: Akim Demaille
Subject: style: prefer bool to char
Date: Sun, 20 Jan 2019 18:34:28 +0100

commit 05b70f47e8583d8bf601210dcef3542cde1d9542
Author: Akim Demaille <address@hidden>
Date:   Sun Jan 20 16:54:33 2019 +0100

    style: prefer bool to char
    
    * src/state.h, src/state.c (state::consistent): Make it a bool.
    Adjust dependencies.

diff --git a/src/lalr.c b/src/lalr.c
index 2fa60533..0f1149d7 100644
--- a/src/lalr.c
+++ b/src/lalr.c
@@ -329,7 +329,7 @@ state_lookahead_tokens_count (state *s, bool 
default_reduction_only_for_accept)
           && default_reduction_only_for_accept))
     n_lookahead_tokens += rp->num;
   else
-    s->consistent = 1;
+    s->consistent = true;
 
   return n_lookahead_tokens;
 }
diff --git a/src/state.c b/src/state.c
index b3c1ffce..0fc93206 100644
--- a/src/state.c
+++ b/src/state.c
@@ -143,7 +143,7 @@ state_new (symbol_number accessing_symbol,
   res->reductions = NULL;
   res->errs = NULL;
   res->state_list = NULL;
-  res->consistent = 0;
+  res->consistent = false;
   res->solved_conflicts = NULL;
   res->solved_conflicts_xml = NULL;
 
diff --git a/src/state.h b/src/state.h
index f450b255..5b37ed6a 100644
--- a/src/state.h
+++ b/src/state.h
@@ -81,6 +81,8 @@
 #ifndef STATE_H_
 # define STATE_H_
 
+# include <stdbool.h>
+
 # include <bitset.h>
 
 # include "gram.h"
@@ -208,9 +210,9 @@ struct state
      store in this member a reference to the node containing each state.  */
   struct state_list *state_list;
 
-  /* If non-zero, then no lookahead sets on reduce actions are needed to
-     decide what to do in state S.  */
-  char consistent;
+  /* Whether no lookahead sets on reduce actions are needed to decide
+     what to do in state S.  */
+  bool consistent;
 
   /* If some conflicts were solved thanks to precedence/associativity,
      a human readable description of the resolution.  */




reply via email to

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