[pushed] gdb: use bool in notify_command_param_changed_p and do_set_command

Simon Marchi simon.marchi@polymtl.ca
Thu Aug 19 18:30:53 GMT 2021


Trivial patch to use bool instead of int.

Change-Id: I9e5f8ee4305272a6671cbaaaf2f0484eff0d1ea5
---
 gdb/cli/cli-setshow.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 0290acede7fa..1025ed2f620d 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -31,17 +31,17 @@
 
 /* Return true if the change of command parameter should be notified.  */
 
-static int
-notify_command_param_changed_p (int param_changed, struct cmd_list_element *c)
+static bool
+notify_command_param_changed_p (bool param_changed, struct cmd_list_element *c)
 {
-  if (param_changed == 0)
-    return 0;
+  if (!param_changed)
+    return false;
 
   if (c->theclass == class_maintenance || c->theclass == class_deprecated
       || c->theclass == class_obscure)
-    return 0;
+    return false;
 
-  return 1;
+  return true;
 }
 
 
@@ -305,7 +305,7 @@ void
 do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 {
   /* A flag to indicate the option is changed or not.  */
-  int option_changed = 0;
+  bool option_changed = false;
 
   gdb_assert (c->type == set_cmd);
 
@@ -359,7 +359,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	    xfree (*(char **) c->var);
 	    *(char **) c->var = newobj;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
 	else
 	  xfree (newobj);
@@ -371,7 +371,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  xfree (*(char **) c->var);
 	  *(char **) c->var = xstrdup (arg);
 
-	  option_changed = 1;
+	  option_changed = true;
 	}
       break;
     case var_filename:
@@ -404,7 +404,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	    xfree (*(char **) c->var);
 	    *(char **) c->var = val;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
 	else
 	  xfree (val);
@@ -420,7 +420,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  {
 	    *(bool *) c->var = val;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
       }
       break;
@@ -432,7 +432,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  {
 	    *(enum auto_boolean *) c->var = val;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
       }
       break;
@@ -445,7 +445,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  {
 	    *(unsigned int *) c->var = val;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
       }
       break;
@@ -481,7 +481,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  {
 	    *(int *) c->var = val;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
 	break;
       }
@@ -499,7 +499,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	  {
 	    *(const char **) c->var = match;
 
-	    option_changed = 1;
+	    option_changed = true;
 	  }
       }
       break;
@@ -510,7 +510,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
 	if (*(int *) c->var != val)
 	  {
 	    *(int *) c->var = val;
-	    option_changed = 1;
+	    option_changed = true;
 	  }
       }
       break;
-- 
2.33.0



More information about the Gdb-patches mailing list