Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Remove a VEC from ppc-linux-nat.c
Date: Sat, 27 Apr 2019 15:23:00 -0000	[thread overview]
Message-ID: <89f81213-c73d-9ed9-8915-cf71487efaba@simark.ca> (raw)
In-Reply-To: <20190427143134.14048-2-tom@tromey.com>

Hi Tom,

LGTM, I just wrote some suggestions below.

On 2019-04-27 10:31 a.m., Tom Tromey wrote:
> @@ -1758,14 +1757,11 @@ hwdebug_point_cmp (struct ppc_hw_breakpoint *a, struct ppc_hw_breakpoint *b)
>  static struct thread_points *
>  hwdebug_find_thread_points_by_tid (int tid, int alloc_new)
>  {
> -  int i;
> -  struct thread_points *t;
> -
> -  for (i = 0; VEC_iterate (thread_points_p, ppc_threads, i, t); i++)
> +  for (thread_points *t : ppc_threads)
>      if (t->tid == tid)
>        return t;

Could you add braces to this for, to match our coding style?

> @@ -2392,22 +2388,22 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
>    int i;
>    int tid = tp->ptid.lwp ();
>    struct hw_break_tuple *hw_breaks;
> -  struct thread_points *t = NULL, *p;
> +  struct thread_points *t = NULL;
>  
>    if (!have_ptrace_hwdebug_interface ())
>      return;
>  
> -  for (i = 0; VEC_iterate (thread_points_p, ppc_threads, i, p); i++)
> -    if (p->tid == tid)
> +  for (i = 0; i < ppc_threads.size (); i++)
> +    if (ppc_threads[i].tid == tid)
>        {
> -	t = p;
> +	t = &ppc_threads[i];
>  	break;
>        }

Here too?

I believe this loop could be a range-based one, though it also works like this.

Simon


  reply	other threads:[~2019-04-27 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27 14:31 [PATCH 0/2] Remove two VECs Tom Tromey
2019-04-27 14:31 ` [PATCH 1/2] Remove a VEC from ppc-linux-nat.c Tom Tromey
2019-04-27 15:23   ` Simon Marchi [this message]
2019-04-27 15:31     ` Simon Marchi
2019-05-04 20:26       ` Tom Tromey
2019-04-27 14:31 ` [PATCH 2/2] Remove a VEC from aarch64-tdep.c Tom Tromey
2019-04-27 15:39   ` 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=89f81213-c73d-9ed9-8915-cf71487efaba@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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