This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] ptid_{lwp,tid}_p: Remove unnecessary checks
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Wed, 5 Apr 2017 16:15:56 +0100
- Subject: Re: [PATCH 1/2] ptid_{lwp,tid}_p: Remove unnecessary checks
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E7B65C04BD55
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E7B65C04BD55
- References: <20170404183235.10589-1-simon.marchi@ericsson.com>
On 04/04/2017 07:32 PM, Simon Marchi wrote:
> 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.
Indeed. LGTM.
Thanks,
Pedro Alves