From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +TgPIhLfpmpk2AgAWB0awg (envelope-from ) for ; Sun, 13 Sep 2026 13:36:18 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=bBGmqX4E; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 43A941E051; Sun, 13 Sep 2026 13:36:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 41A8B1E033 for ; Sun, 13 Sep 2026 13:36:14 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F23694BB1C03 for ; Sun, 13 Sep 2026 17:36:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F23694BB1C03 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=bBGmqX4E Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id D6F674BA23FB for ; Sun, 13 Sep 2026 17:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6F674BA23FB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D6F674BA23FB Authentication-Results: sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789320941; cv=none; b=Bc2EGuBm34WjW0r/FTGpAUIJgXpmPdfhY9i90kH9HnXHieYPtnMtqWPmP88kVUm4URbbahCckYDdVgrDdhSzE08EeZWzOEXo5q2MsowRb+/zOIkKxPTDlpoM/r44WJhrTQdsM9Qt5nMLGcZuIKB1dGVNzcX57jKgFMZ7uLtA5tM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789320941; c=relaxed/simple; bh=SpUzfHJgmaGVF0DkAN7AgDdFICe9+K1u6+U2RTsrQzY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fktoahrfMW0fbt1Cah8R9YxrL+B9r2HZD6AkLxS1uSNS//iI+rkXP6sMzlQ7+4pqDDP4G0qy6LTeo9ev2yDYnrMZGw77z66/VTKiquTj1IRLHwDL6iyagMJEve3B9ERipTsgemDYR7enGFqDwW0onLyY8tmC0mWiLwuaOnvdiCQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=bBGmqX4E reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6F674BA23FB Received: from eig-obgw-6006b.ext.cloudfilter.net ([10.0.30.211]) by cmsmtp with ESMTPS id 5MOpxJtCOJFmF5o7AxUK5Z; Sun, 13 Sep 2026 17:35:40 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 5o79xbKzPY4rX5o79xliB1; Sun, 13 Sep 2026 17:35:39 +0000 X-Authority-Analysis: v=2.4 cv=CI8qXQrD c=1 sm=1 tr=0 ts=6aa6deeb a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=VdqzKS8jKosA:10 a=ItBw4LHWJt0A:10 a=m53bTyrieQBq_zMEN3wA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dqodM6k9VyZ+JogXJSiLfS3e34ps9Dg/zlCzMze4m/4=; b=bBGmqX4EoR4KIocJki5aM0KM6+ DGjUSfVOldVancOGWJ426av8Kt72kX1bLf+J2AILM3Bs6nWI0azCiw7yb6vJvvqJALkCRfGHRPz4+ 99tXCVvjhfEuXQa59NryzZ4xy; Received: from 97-122-117-2.hlrn.qwest.net ([97.122.117.2]:54284 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100) (envelope-from ) id 1x5o78-00000001XS4-4235; Sun, 13 Sep 2026 11:35:39 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Inline build_bp_list into its only caller Date: Sun, 13 Sep 2026 11:35:28 -0600 Message-ID: <20260913173528.3877931-1-tom@tromey.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.117.2 X-Source-L: No X-Exim-ID: 1x5o78-00000001XS4-4235 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-117-2.hlrn.qwest.net (localhost.localdomain) [97.122.117.2]:54284 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNINCvDIsmos5OmZoCXYnE5uYf6D1fRF6lEnPritoWoDtnS6hj2ObxYpB+xngnM5cq+oej3UnlJ3VO7U9RIjzcgrCTdMwFAWn0kT791FgbV6wls6ibY9 6/x2WNMevTRvZW8+ZiqSvwJtSYlKHEKcvmnN7pSNlRYBYMnZuZc39/wUvLbYR6O+xeMY6GVvgWlJsq/DSDLd/yHvcsmP41TW7ZQ= 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 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 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; + + /* 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_obj == nullptr) + continue; + + if (PyList_Append (list.get (), bp_obj) < 0) + return nullptr; + } return PyList_AsTuple (list.get ()); } -- 2.49.0