From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61932 invoked by alias); 27 Apr 2019 15:23:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 61919 invoked by uid 89); 27 Apr 2019 15:23:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=our X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 27 Apr 2019 15:23:54 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3193F1E7B0; Sat, 27 Apr 2019 11:23:52 -0400 (EDT) Subject: Re: [PATCH 1/2] Remove a VEC from ppc-linux-nat.c To: Tom Tromey , gdb-patches@sourceware.org References: <20190427143134.14048-1-tom@tromey.com> <20190427143134.14048-2-tom@tromey.com> From: Simon Marchi Message-ID: <89f81213-c73d-9ed9-8915-cf71487efaba@simark.ca> Date: Sat, 27 Apr 2019 15:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190427143134.14048-2-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00599.txt.bz2 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