[PATCH 2/2] Use XOBNEW when possible
Simon Marchi
simon.marchi@polymtl.ca
Thu Apr 26 02:59:00 GMT 2018
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
More information about the Gdb-patches
mailing list