From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 5xSiOHDs7Gp23CIAWB0awg (envelope-from ) for ; Thu, 05 Nov 2026 15:52:00 -0500 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=d6H0Jo8a; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D0EFA1E043; Thu, 05 Nov 2026 15:52:00 -0500 (EST) 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 2097C1E043 for ; Thu, 05 Nov 2026 15:52:00 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BAE84BA2E1E for ; Thu, 5 Nov 2026 20:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BAE84BA2E1E 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=d6H0Jo8a Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id B5CF14BA2E05 for ; Thu, 5 Nov 2026 20:51:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B5CF14BA2E05 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 B5CF14BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793911895; cv=none; b=kFrbeWOC1ECyJeQxZLjGuEcG8QIXQJo7yfwYUnC/C0rbTeYa2FJj8xyltpn4DgnUi/0bVurVRdkLC8j6CTmnG/e1of0w9hdToJH3GQ7v9LkO3gi+2Il9AdzNnXP1HZcf7Vvm3ysOXNr1exW8w5jqbMwTCq8xKccghcHf/sGMH3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793911895; c=relaxed/simple; bh=PVixqFWkxdUtgcoUgEjgdSkguEnLpdYT5zjNfXQ9ya0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XdooL4s5YF07aAhE8U8jUf6xVYozbiXgP88zbZUXH3VoFE6I1UNq2eqX5/1oUrBUqnOjhGTLRneTzEwvcjW8IeeHGwHmsocpN2qjORo/veomn9tpg1asq/nJ9ubZ33Q4rfOt8BhrXj7LVfJRxDl8xfGoXuhBGKCjRRyIqQdEFKk= 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=d6H0Jo8a reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5CF14BA2E05 Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id P3U5xAzfXAR1iP4Qox6qhv; Thu, 05 Nov 2026 20:51:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id P4QnxVrTrxqjjP4QoxDkT2; Thu, 05 Nov 2026 20:51:34 +0000 X-Authority-Analysis: v=2.4 cv=bZxrUPPB c=1 sm=1 tr=0 ts=6aecec56 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=zJRp6_cAMcgA:10 a=ItBw4LHWJt0A:10 a=7CQSdrXTAAAA:8 a=l1ARgfuseSPqxpLb_6AA:9 a=a-qgeE7W1pNrGK8U0ZQC:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=96NPRo9XFrgJTj09hPRtoJPxccBcGHVs4P5uE91Qm/Q=; b=d6H0Jo8alNg6aIJ9Ory731HUO0 qJQ+zcmBFmX+SuwdXJ3Qd2o4cQ070qxDPvogZ536PSNjlcwqovNAoaWDF6Y4VS6+SyA55rws5paV2 AvqHzZwOZQXEAvBDkMvij3UCa; Received: from 97-122-110-129.hlrn.qwest.net ([97.122.110.129]:54546 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xP4Qn-000000003C9-29B7; Thu, 05 Nov 2026 13:51:33 -0700 From: Tom Tromey To: Matthieu Longo Cc: , Andrew Burgess , Tom Tromey Subject: Re: [PATCH v3 4/8] gdbsupport: add extract_next_field helper In-Reply-To: <20260922135050.236941-5-matthieu.longo@arm.com> (Matthieu Longo's message of "Tue, 22 Sep 2026 14:50:46 +0100") References: <20260922135050.236941-1-matthieu.longo@arm.com> <20260922135050.236941-5-matthieu.longo@arm.com> X-Attribution: Tom Date: Thu, 05 Nov 2026 13:51:32 -0700 Message-ID: <871p8zxaqz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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.110.129 X-Source-L: No X-Exim-ID: 1xP4Qn-000000003C9-29B7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-129.hlrn.qwest.net (bapiya) [97.122.110.129]:54546 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIZOu8MLk0UO8H1MpLQ5XZIGcIwQgT/YOrL+0jxIaRlS4BF3qjlMehreQixAFOvrkfJQjWVo64nP5Z8ZuZy6roorcelwPyUUQ7Ye/F+vtmUYxly5Sjiu aUMFkjBc1KPT0Nbhbmf+CVdnPEyyLg5JaA3OQ2Qj0+R+98gI7V8U2CXARG5vVus/EXHjYwFuiqZiyOOtHTsHFGfhJLRO1EluPOY= 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 >>>>> Matthieu Longo writes: > Add extract_next_field, a helper for extracting a view from a buffer > up to a given separator. The helper also returns an iterator to the > beginning of the next entry, skipping consecutive separators. > The helper supports views whose value type is 'char', such as > gdb::array_view and std::string_view (from c++20). Thanks for the patch. I think this looks essentially ok but I have some nits. > diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h > index de83a715ac4..a4042b24644 100644 > --- a/gdbsupport/common-utils.h > +++ b/gdbsupport/common-utils.h I think we should normally not add more stuff to the various "utils" files. These end up just being random grab bags of stuff. I think adding a new header file in gdbsupport should be pretty easy. You don't even have to patch the build. > + /* Skip leading occurrences of the separator. */ > + while (start != buffer.end () && *start == separator) > + ++start; This uses ++, which seems fine. > + /* If no separator is found, the remainder of BUFFER is the final string. */ > + if (it != buffer.end ()) > + { > + /* Otherwise, skip successive separators so that NEXT_START points to > + the beginning of the next string, if any. */ > + for (next_start = std::next (it); > + next_start != buffer.end () && *next_start == separator; > + next_start = std::next (next_start)); ... but this uses std::next -- which is also fine, but made me wonder if there's a reason for the difference. Also, is this second separator-skipping loop even needed? Because it seems like it would be fine to just end here and let the next call to extract_next_field skip these now-leading separators. Maybe it's important to the callers that these be skipped. I haven't looked. Tom