Re: [PATCH 2/2] Use XOBNEW when possible

Tom Tromey
2018-04-25T22:27:35Z

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

Simon> + e = XOBNEW (&mdebugread_objfile->objfile_obstack,
Simon> + mdebug_extra_func_info);
Simon> memset (e, 0, sizeof (struct mdebug_extra_func_info));

There seem to be a few.

Tom