From: Simon Marchi <simark@simark.ca>
To: Guinevere Larsen <guinevere@redhat.com>,
Tom Tromey <tromey@adacore.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH 0/2] More uses of make_unique_xstrdup
Date: Thu, 15 Jan 2026 13:01:09 -0500 [thread overview]
Message-ID: <9d7acb9f-9dad-45fe-8ea9-8793e8177264@simark.ca> (raw)
In-Reply-To: <3bf1b983-e7c6-4d76-8c87-9a0d3523d8b3@redhat.com>
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 <tromey@adacore.com>
>
> 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
next prev parent reply other threads:[~2026-01-15 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 17:33 Tom Tromey
2026-01-15 17:33 ` [PATCH 1/2] Use make_unique_xstrdup in more places Tom Tromey
2026-01-15 17:33 ` [PATCH 2/2] Use make_unique_xstrdup in tracepoint Tom Tromey
2026-01-15 17:39 ` [PATCH 0/2] More uses of make_unique_xstrdup Guinevere Larsen
2026-01-15 18:01 ` Simon Marchi [this message]
2026-01-15 18:16 ` Guinevere Larsen
2026-01-16 14:14 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d7acb9f-9dad-45fe-8ea9-8793e8177264@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=guinevere@redhat.com \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox