From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id C5UkAlr7p2rIJAwAWB0awg (envelope-from ) for ; Mon, 14 Sep 2026 09:49:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1789393753; bh=bXq7aCM/qgMZayGpmlQDXQYI+bqoVlRkdctL/+OZu7I=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xVae04K1ERn5x/0xRMystVb6s5iEQ8sFrFlwy0UNA5fLA9cfNuN9/MOLMH2SWos1j tjRLV8V2emg3mzp9KPtuIlRVh/2MuqzOBUVxwrHqVt7zCYOYk0LF7XiSs9ADhKZuR0 Wu/MKk818/lmYs0dgT4ti+oXSrJ+utxamyCtFYZs= Received: by simark.ca (Postfix, from userid 112) id E54641E066; Mon, 14 Sep 2026 09:49:13 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=no46IquZ; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 54E841E01F for ; Mon, 14 Sep 2026 09:49:13 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7D024B99F4D for ; Mon, 14 Sep 2026 13:49:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7D024B99F4D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=no46IquZ Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id B62E14BAE7DC for ; Mon, 14 Sep 2026 13:48:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B62E14BAE7DC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B62E14BAE7DC Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789393729; cv=none; b=MlREcKrCkAVFb45H8TOs60Qn5hkzI3jf7UPA4JyfDTQl1LS97IWDL6R6IuD4IdOK352c3v0TuvwLoj9jBZplN+Uu9IzSYIPFhod8pzhXJOPKbF67KG7VzOCttaW9TmQa+gmAP2nMEkvqbxOyC3dkkAbNsRjdWm8agQZ2pZZXigA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789393729; c=relaxed/simple; bh=bXq7aCM/qgMZayGpmlQDXQYI+bqoVlRkdctL/+OZu7I=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Lb1lwAPqcKJfhMbrkhZdlw5NzBSFHew6+1OV9pLRGfFoswgfyN7/MsHjtMBaZVWqj9CNfEmeQ4g88oROHI8H5KLIS+Aoia0pNjyeGQ762JsWVKtHn/58FqNbNZm8W9dcstcRz57vwzaxJEHWSD9bN9+nvkwNKWllAuy7AUDQseo= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=no46IquZ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B62E14BAE7DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1789393729; bh=bXq7aCM/qgMZayGpmlQDXQYI+bqoVlRkdctL/+OZu7I=; h=Date:Subject:To:References:From:In-Reply-To:From; b=no46IquZ0CbHuBXA1r/5Ehl5ijoCl51aoo1+eHYPk+XJ2lzzHMiMssM8n544FWoqP 9i5SCasZTsPhjej+yQ316Rld894al1JlRuO+JeV6J2cQJ3Bx2LAf3DOPLnCVPCPeaJ ed0EAh7EfIaNLYxhZs3uBDaWbJMpgdSoijm1bBG8= Received: by simark.ca (Postfix) id 577E61E01F; Mon, 14 Sep 2026 09:48:49 -0400 (EDT) Message-ID: <273fbe38-f21e-4ffa-8740-eeebd45f0558@simark.ca> Date: Mon, 14 Sep 2026 09:48:48 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Inline build_bp_list into its only caller To: Tom Tromey , gdb-patches@sourceware.org References: <20260913173528.3877931-1-tom@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20260913173528.3877931-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 9/13/26 1:35 PM, Tom Tromey wrote: > While working on safety patches for py-breakpoint.c, I ran across > build_bp_list. This is called from just one place, and it seems > cleaner to inline it into its sole caller. > --- > gdb/python/py-breakpoint.c | 35 +++++++++++++---------------------- > 1 file changed, 13 insertions(+), 22 deletions(-) > > diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c > index ecb42cee5f9..e5df4459dd6 100644 > --- a/gdb/python/py-breakpoint.c > +++ b/gdb/python/py-breakpoint.c > @@ -1089,26 +1089,6 @@ bppy_repr (PyObject *self) > bp->bp->hit_count, str.c_str ()); > } > > -/* Append to LIST the breakpoint Python object associated to B. > - > - Return true on success. Return false on failure, with the Python error > - indicator set. */ > - > -static bool > -build_bp_list (struct breakpoint *b, PyObject *list) > -{ > - PyObject *bp = (PyObject *) b->py_bp_object; > - > - /* Not all breakpoints will have a companion Python object. > - Only breakpoints that were created via bppy_new, or > - breakpoints that were created externally and are tracked by > - the Python Scripting API. */ > - if (bp == nullptr) > - return true; > - > - return PyList_Append (list, bp) == 0; > -} > - > /* See python-internal.h. */ > > bool > @@ -1144,8 +1124,19 @@ gdbpy_breakpoints (PyObject *self, PyObject *args) > /* If build_bp_list returns false, it signals an error condition. In that This comment refers to the new removed function. > case abandon building the list and return nullptr. */ > for (breakpoint &bp : all_breakpoints ()) > - if (!build_bp_list (&bp, list.get ())) > - return nullptr; > + { > + PyObject *bp_obj = (PyObject *) bp.py_bp_object; I'd remove the `bp` variable and use bp.py_bp_object directly. Otherwise, LGTM. Approved-By: Simon Marchi Simon