From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PCZjHoAraWmXFwUAWB0awg (envelope-from ) for ; Thu, 15 Jan 2026 13:01:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1768500096; bh=ErgsjyyF9J/Pvr8oc3rn0rBZsj2mwgStGNvRY/k5qYk=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GzkvqkW9uynfo01XjJC9A8fuLfZGxVR0PyRKOP10e65mF6iZRLvIrHG7c75sC3F9u 7M+Ob4K/h/0PRf6/T0v+Z0YLJ4MyBbpLNx1Jv91X2kLtwDv9G2LtHgfCQl59nUKdCd +3MZUMeaXroo97sCMLAJz7YkfYeGPiDtLxkRfRVM= Received: by simark.ca (Postfix, from userid 112) id 6CB8E1E070; Thu, 15 Jan 2026 13:01:36 -0500 (EST) 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=pCgB+DOq; 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 B58501E070 for ; Thu, 15 Jan 2026 13:01:35 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 468CC4BA2E27 for ; Thu, 15 Jan 2026 18:01:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 468CC4BA2E27 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=pCgB+DOq Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id A9F544BA2E1C for ; Thu, 15 Jan 2026 18:01:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9F544BA2E1C 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 A9F544BA2E1C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768500070; cv=none; b=k8IlGAN3u2cRnxa3t17zIi0gFDSLp66R7DoXgdQkFjYaXlMhBb8asRCPLqDhIBDmFT0cyDBxmvf2J9/whG9EOGwSh0Tdpv8UG4nJwlouHOyhtMCCJqgmRp2tDWNaeNnh1TUg98EmTCgJ2zHzUZvSadptQemM0g1O6NE1nBgJyHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768500070; c=relaxed/simple; bh=ErgsjyyF9J/Pvr8oc3rn0rBZsj2mwgStGNvRY/k5qYk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=TbB4bes4G2FWY1nQR7DxOQFsc0WIX9G38nAM9sDlpiyaGlMnU0McwobTNIwXWV0schM1EguDM7a/Vk7Ceba6TF6zliYmpM3+wc0o+8kPhj7dl8UblNRSPOqkpxbQNq9YSmHu0TRFJMdXMN1w4eycVv14veVKHrQhGKmz6l9KLMk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9F544BA2E1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1768500070; bh=ErgsjyyF9J/Pvr8oc3rn0rBZsj2mwgStGNvRY/k5qYk=; h=Date:Subject:To:References:From:In-Reply-To:From; b=pCgB+DOqDtVom53uVLFdHiZ9rCdmS+1HL0SPRKYZWlEOF0TvOIwbrufVXw/Wlf7TR Ks7eDIMXCmFQxRqmX0QUvDpz6mpurBt4dfkkq0bbzdwPISLw9dnT3WuR8w6o6prPbd Fg+dwD5MYNJtBoUYL5ZeesRHzWR1UBTAivIVTuDo= Received: by simark.ca (Postfix) id DD2621E070; Thu, 15 Jan 2026 13:01:09 -0500 (EST) Message-ID: <9d7acb9f-9dad-45fe-8ea9-8793e8177264@simark.ca> Date: Thu, 15 Jan 2026 13:01:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] More uses of make_unique_xstrdup To: Guinevere Larsen , Tom Tromey , gdb-patches@sourceware.org References: <20260115-xstrdup-v1-0-72e13ba99851@adacore.com> <3bf1b983-e7c6-4d76-8c87-9a0d3523d8b3@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <3bf1b983-e7c6-4d76-8c87-9a0d3523d8b3@redhat.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 1/15/26 12:39 PM, Guinevere Larsen wrote: > On 1/15/26 2:33 PM, Tom Tromey wrote: >> This replaces some uses of '.reset(xstrdup())' with >> '= make_unique_xstrdup()'. I think explicit uses of reset >> should be avoided when possible. >> >> Regression tested on x86-64 Fedora 41. >> >> Signed-off-by: Tom Tromey > > This makes me wonder... is there any reason to prefer xmalloc/xstrdup instead of using std::string? > > My preference is to use stdlib stuff when possible, but maybe I'm misjudging the size of the refactor or there's a reason to prefer the current memory strategy. When practical to switch to std::string, it typically is an improvement. It makes strings manipulation safer and clearer. There might be cases where it is not trivial to use std::string immediately though, so switching to make_unique_xstrdup is a good incremental change nonetheless. Simon