This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] ptid_{lwp,tid}_p: Remove unnecessary checks
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 5 Apr 2017 19:20:54 -0000
- Subject: [binutils-gdb] ptid_{lwp,tid}_p: Remove unnecessary checks
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4e9868d4e0c8e45505876901d22c021dd36972a8
commit 4e9868d4e0c8e45505876901d22c021dd36972a8
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Wed Apr 5 15:15:59 2017 -0400
ptid_{lwp,tid}_p: Remove unnecessary checks
The calls to ptid_equal in ptid_lwp_p and ptid_tid_p that compare the
argument to minus_one_ptid and null_ptid are not necessary. The calls
in question are:
if (ptid_equal (minus_one_ptid, ptid)
|| ptid_equal (null_ptid, ptid))
return 0;
minus_one_ptid is { .pid = -1, .lwp = 0, .tid = 0 }
null_ptid is { .pid = 0, .lwp = 0, .tid = 0 }
If the ptid argument is either of them, the statements
return (ptid_get_lwp (ptid) != 0);
and
return (ptid_get_tid (ptid) != 0);
will yield the same result (0/false).
gdb/ChangeLog:
* common/ptid.c (ptid_lwp_p, ptid_tid_p): Remove comparison with
minus_one_ptid and null_ptid.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/common/ptid.c | 8 --------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d21436c..880af5b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-05 Simon Marchi <simon.marchi@ericsson.com>
+
+ * common/ptid.c (ptid_lwp_p, ptid_tid_p): Remove comparison with
+ minus_one_ptid and null_ptid.
+
2017-04-05 Pedro Alves <palves@redhat.com>
* warning.m4 (build_warnings): Remove -Wno-write-strings.
diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 05c0db1..b56971b 100644
--- a/gdb/common/ptid.c
+++ b/gdb/common/ptid.c
@@ -97,10 +97,6 @@ ptid_is_pid (ptid_t ptid)
int
ptid_lwp_p (ptid_t ptid)
{
- if (ptid_equal (minus_one_ptid, ptid)
- || ptid_equal (null_ptid, ptid))
- return 0;
-
return (ptid_get_lwp (ptid) != 0);
}
@@ -109,10 +105,6 @@ ptid_lwp_p (ptid_t ptid)
int
ptid_tid_p (ptid_t ptid)
{
- if (ptid_equal (minus_one_ptid, ptid)
- || ptid_equal (null_ptid, ptid))
- return 0;
-
return (ptid_get_tid (ptid) != 0);
}