Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Keith Seitz <keiths@redhat.com>
Cc: "gdb-patches\@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA] c++/13615
Date: Thu, 15 Nov 2012 22:00:00 -0000	[thread overview]
Message-ID: <87zk2iv86d.fsf@fleche.redhat.com> (raw)
In-Reply-To: <50A41182.2020500@redhat.com> (Keith Seitz's message of "Wed, 14	Nov 2012 13:47:46 -0800")

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> I've added a test for this and updated the patch to correct that bug.

Thanks.

Keith> ChangeLog
Keith> 2012-11-14  Keith Seitz  <keiths@redhat.com>
Keith> 	c++/13615

The commit message parser needs to see the text "PR" in there:

	PR c++/13615

Keith> +static struct symbol *
Keith> +find_symbol_in_baseclass (struct type *parent_type, const char *name,
Keith> +			   const struct block *block)
Keith> +{

Three minor notes here...

Keith> +  cleanup = make_cleanup (null_cleanup, NULL);
Keith> +  for (i = 0; i < TYPE_N_BASECLASSES (parent_type); ++i)
Keith> +    {
Keith> +      const char *base_name = TYPE_BASECLASS_NAME (parent_type, i);

First, can this ever be NULL?

Keith> +      discard_cleanups (cleanup);
Keith> +      concatenated_name = xrealloc (concatenated_name,
Keith> +				    (strlen (base_name) + 2
Keith> +				     + strlen (name) + 1));
Keith> +      cleanup = make_cleanup (xfree, concatenated_name);

Second, I was confused by this code the first time through -- discarding
the cleanup and then re-creating it is a bit unusual.
I think it would be simpler & cleaner to do something like:

char *concatenated_name = NULL;
struct cleanup *cleanup = make_cleanup (free_current_contents,
                                        &concatenated_name);

... and then just ignore the cleanup chain in the loop.

Keith> +      sprintf (concatenated_name, "%s::%s", base_name, name);

... or maybe some other approach since we're trying to get rid of
sprintf uses.

Otherwise this looks good to me.

Tom


  reply	other threads:[~2012-11-15 22:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 23:24 Keith Seitz
2012-09-26 20:52 ` Tom Tromey
2012-10-05 19:45   ` Keith Seitz
2012-11-08 21:57     ` Tom Tromey
2012-11-08 21:59       ` Tom Tromey
2012-11-14 21:48         ` Keith Seitz
2012-11-15 22:00           ` Tom Tromey [this message]
2012-11-16 18:47             ` Keith Seitz
2012-11-16 19:10               ` Tom Tromey
2012-11-16 20:56                 ` Keith Seitz
2012-11-08 22:27       ` Tom Tromey
2012-11-13 20:44       ` 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=87zk2iv86d.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.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