public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/2] Use XOBNEW when possible
Date: Wed, 25 Apr 2018 22:27:00 -0000	[thread overview]
Message-ID: <87wowu7whb.fsf@tromey.com> (raw)
In-Reply-To: <1524685183-5553-2-git-send-email-simon.marchi@ericsson.com>	(Simon Marchi's message of "Wed, 25 Apr 2018 15:39:43 -0400")

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

  reply	other threads:[~2018-04-25 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 19:40 [PATCH 1/2] Introduce obstack_new, poison other "typed" obstack functions Simon Marchi
2018-04-25 19:40 ` [PATCH 2/2] Use XOBNEW when possible Simon Marchi
2018-04-25 22:27   ` Tom Tromey [this message]
2018-04-26  2:59     ` Simon Marchi
2018-04-25 22:36 ` [PATCH 1/2] Introduce obstack_new, poison other "typed" obstack functions Tom Tromey
2018-04-26  2:58   ` Simon Marchi
2018-04-26 17:42     ` 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=87wowu7whb.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).