Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Use gdb::unique_xmalloc_ptr when calling tilde_expand
Date: Fri, 04 Aug 2017 20:34:00 -0000	[thread overview]
Message-ID: <12e4ff13f71f3c44b6407e87b86ade08@polymtl.ca> (raw)
In-Reply-To: <7f9192116eeb22b959a56145e70ee2d4@polymtl.ca>

On 2017-08-04 22:28, Simon Marchi wrote:
> On 2017-08-04 19:13, Tom Tromey wrote:
>> Simon> There is still a cleanup in reload_shared_libraries_1, so I 
>> don't
>> Simon> think the do_cleanups should be removed.
>> 
>> Ugh, sorry about that.
>> 
>> That code is duplicating the bfd's file name.  But I can't see why
>> that's important.  I think just removing the xstrdup and the
>> make_cleanup is the right thing to do here.  What do you think?
>> 
>> Tom
> 
> I don't see any reason either.
> 
> Simon

Actually, if we look at the code before you introduced gdb_bfd_ref_ptr, 
the lifetime of abfd was shorter than the required lifetime of the 
string.  Since freeing the bfd frees the name internally, one option was 
to make a copy.  With gdb_bfd_ref_ptr, the lifetime of abfd is long 
enough that we don't need the copy.

Simon


  reply	other threads:[~2017-08-04 20:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 21:44 Tom Tromey
2017-08-04  9:41 ` Simon Marchi
2017-08-04 13:44   ` Tom Tromey
2017-08-04 14:52     ` Simon Marchi
2017-08-04 17:13       ` Tom Tromey
2017-08-04 20:28         ` Simon Marchi
2017-08-04 20:34           ` Simon Marchi [this message]
2017-08-05 16:25           ` Tom Tromey
2017-08-05 16:40             ` Simon Marchi

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=12e4ff13f71f3c44b6407e87b86ade08@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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