This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH 2/2] Use XOBNEW when possible


On 2018-04-25 18:27, Tom Tromey wrote:
"Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:

Simon> Since XOBNEW is now poisoned to prevent using it with
Simon> non-trivially-constructible objects, it is worth using it over plain Simon> obstack_alloc. This patch changes the locations I could find where we
Simon> can do that change easily.

Thanks.

Simon> -  struct hppa_objfile_private *priv;
Simon> +  hppa_objfile_private *priv
Simon> +    = XOBNEW (&objfile->objfile_obstack, hppa_objfile_private);

Simon> -  priv = (struct hppa_objfile_private *)
Simon> -  	 obstack_alloc (&objfile->objfile_obstack,
Simon> -	 		sizeof (struct hppa_objfile_private));
Simon>    set_objfile_data (objfile, hppa_objfile_priv_data, priv);
Simon>    memset (priv, 0, sizeof (*priv));

Maybe ones that memset should be using OBSTACK_ZALLOC.

Right, I'll do that.

Thanks,

Simon


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