This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] c++/13615

>>>>> "Keith" == Keith Seitz <> writes:

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


Keith> ChangeLog
Keith> 2012-11-14  Keith Seitz  <>
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,

... 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]