Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH 1/2] ptid_{lwp,tid}_p: Remove unnecessary checks
Date: Tue, 04 Apr 2017 18:32:00 -0000	[thread overview]
Message-ID: <20170404183235.10589-1-simon.marchi@ericsson.com> (raw)

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.
---
 gdb/common/ptid.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c
index 05c0db17dd..b56971b9af 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);
 }
 
-- 
2.11.0


             reply	other threads:[~2017-04-04 18:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 18:32 Simon Marchi [this message]
2017-04-04 18:33 ` [PATCH 2/2] Class-ify ptid_t Simon Marchi
2017-04-05 15:47   ` Pedro Alves
2017-04-05 19:44     ` Simon Marchi
2017-04-05 21:31       ` Pedro Alves
2017-04-06  2:15         ` Simon Marchi
2017-04-06 10:49           ` Pedro Alves
2017-04-06 11:12             ` Pedro Alves
2017-04-06 14:32               ` Simon Marchi
2017-04-06 14:38                 ` Pedro Alves
2017-04-06  3:09         ` Simon Marchi
2017-04-06 11:06           ` Pedro Alves
2017-04-05 15:15 ` [PATCH 1/2] ptid_{lwp,tid}_p: Remove unnecessary checks Pedro Alves
2017-04-05 19:21   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170404183235.10589-1-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox