From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Use unique_xmalloc_ptr in Python code
Date: Wed, 09 Nov 2016 23:20:00 -0000 [thread overview]
Message-ID: <71852739-1e5c-6be8-eb21-822c67bc0ea9@redhat.com> (raw)
In-Reply-To: <1478292124-26362-1-git-send-email-tom@tromey.com>
On 11/04/2016 08:42 PM, Tom Tromey wrote:
> This changes some utility functions in the Python code to return
> unique_xmalloc_ptr, and then fixes up the callers.
>
> I chose unique_xmalloc_ptr rather than std::string because at a few
> call points the xmalloc'd string is released and ownership transferred
> elsewhere.
IMO, for simplicity sake, we should default to use std::string, unless
we're ending up storing the result in some long lived objects where
memory really is a concern (because of many instances), and a final
string dup/copy to destination wouldn't be too heavy too. I doubt
that's the case here, but it's not easy to see without trying.
Did you try a std::string approach first?
In any case, this is strictly an improvement, so OK with me. Please
push. Let's get this out of the way of your py-ref series.
We can convert to std::string at some other point, if desirable.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2016-11-09 23:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 20:42 Tom Tromey
2016-11-09 23:20 ` Pedro Alves [this message]
2016-11-09 23:41 ` Tom Tromey
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=71852739-1e5c-6be8-eb21-822c67bc0ea9@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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