aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-01-10 11:27:34 +0100
committerTom de Vries <tdevries@suse.de>2024-01-10 11:27:34 +0100
commit94e037b46cecb9198efba5c07f205864d948458a (patch)
tree35cb61cf16015ec918a1339647dd9baea296019a /gdb
parent42bd6b5fd4f9e41f99d80a8f2946926503299e5e (diff)
downloadfsf-binutils-gdb-94e037b46cecb9198efba5c07f205864d948458a.zip
fsf-binutils-gdb-94e037b46cecb9198efba5c07f205864d948458a.tar.gz
fsf-binutils-gdb-94e037b46cecb9198efba5c07f205864d948458a.tar.bz2
[gdb] Make variable printed bool in info_checkpoints_command
While reading info_checkpoints_command, I noticed variable printed: ... const fork_info *printed = NULL; ... for (const fork_info &fi : fork_list) { if (requested > 0 && fi.num != requested) continue; printed = &fi; ... } if (printed == NULL) ... has pointer type, but is just used as bool. Make this explicit by changing the variable type to bool. Tested on x86_64-linux. Approved-By: Kevin Buettner <kevinb@redhat.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/linux-fork.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 1430ff8..177a012 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -583,7 +583,7 @@ info_checkpoints_command (const char *arg, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
int requested = -1;
- const fork_info *printed = NULL;
+ bool printed = false;
if (arg && *arg)
requested = (int) parse_and_eval_long (arg);
@@ -592,8 +592,8 @@ info_checkpoints_command (const char *arg, int from_tty)
{
if (requested > 0 && fi.num != requested)
continue;
+ printed = true;
- printed = &fi;
if (fi.ptid == inferior_ptid)
gdb_printf ("* ");
else
@@ -623,7 +623,8 @@ info_checkpoints_command (const char *arg, int from_tty)
gdb_putc ('\n');
}
- if (printed == NULL)
+
+ if (!printed)
{
if (requested > 0)
gdb_printf (_("No checkpoint number %d.\n"), requested);