This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Remove a VEC from ppc-linux-nat.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]