From: Tom Tromey <tromey@redhat.com>
To: Sami Wagiaalla <swagiaal@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [patch] Fix using_directive memory leak pr 11236
Date: Wed, 03 Mar 2010 21:49:00 -0000 [thread overview]
Message-ID: <m3k4tt3wld.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4B8ECACA.9010504@redhat.com> (Sami Wagiaalla's message of "Wed, 03 Mar 2010 15:47:06 -0500")
>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:
Sami> PR C++/11236:
Sami> * cp-namespace.c (cp_add_using): Deleted.
Sami> (cp_add_using_directive): Use obstack allocations.
Sami> Merged the function cp_add_using into this one.
Sami> Added 'struct obstack *' argument.
Sami> (cp_scan_for_anonymous_namespaces): Updated.
Sami> * cp-support.h: Updated.
Sami> * dwarf2read.c (read_import_statement): Updated.
Sami> (read_namespace): Updated.
Sami> (new_symbol): Updated.
Sami> * stabsread.c (define_symbol): Updated.
Thanks for doing this.
This general idea is fine, but I have a few comments.
Sami> -cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
Sami> +cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
Sami> + struct obstack *obstack)
I don't think you need a new argument here.
Instead, I think you can use SYMBOL_SYMTAB (symbol)->obstack.
Sami> if (strcmp (current->import_src, src) == 0
Sami> - && strcmp (current->import_dest, dest) == 0)
Sami> + && strcmp (current->import_dest, dest) == 0
Sami> + && alias && strcmp (current->alias, alias) == 0)
This logic is incorrect if current->alias == NULL.
Sami> + new = obstack_alloc (obstack, sizeof (struct using_direct));
Sami> + memset (new, 0, sizeof (struct using_direct));
Use OBSTACK_ZALLOC here.
thanks,
Tom
next prev parent reply other threads:[~2010-03-03 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 20:51 Sami Wagiaalla
2010-03-03 21:49 ` Tom Tromey [this message]
2010-03-08 16:33 ` Sami Wagiaalla
2010-03-08 17:59 ` Tom Tromey
2010-03-09 18:19 ` Sami Wagiaalla
2010-03-09 18:26 ` 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=m3k4tt3wld.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=swagiaal@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