public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] replace some obstack_alloc () calls with the XOBNEW wrapper
@ 2016-03-28 23:56 tbsaunde+binutils
  2016-03-29  8:42 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: tbsaunde+binutils @ 2016-03-28 23:56 UTC (permalink / raw)
  To: binutils; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

Hi,

$subject, the wrapper is shorter :)

built and regtested bfin-elf, hppa-linux, and m68k-elf, ok?

Trev

gas/ChangeLog:

2016-03-28  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-bfin.c (gencode): Use XOBNEW obstack_alloc () wrapper.
	* config/tc-hppa.c (fix_new_hppa): Likewise.
	(pa_vtable_entry): Likewise.
	(pa_vtable_inherit): Likewise.
	* config/tc-m68k.c (md_begin): Likewise.
---
 gas/config/tc-bfin.c | 2 +-
 gas/config/tc-hppa.c | 6 +++---
 gas/config/tc-m68k.c | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index e14fbe1..c7b9d8d 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -937,7 +937,7 @@ note_reloc2 (INSTR_T code, const char *symbol, int reloc, int value, int pcrel)
 INSTR_T
 gencode (unsigned long x)
 {
-  INSTR_T cell = obstack_alloc (&mempool, sizeof (struct bfin_insn));
+  INSTR_T cell = XOBNEW (&mempool, struct bfin_insn);
   memset (cell, 0, sizeof (struct bfin_insn));
   cell->value = (x);
   return cell;
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index c3e1d75..bd2357e 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1194,7 +1194,7 @@ fix_new_hppa (fragS *frag,
 	      int unwind_bits ATTRIBUTE_UNUSED)
 {
   fixS *new_fix;
-  struct hppa_fix_struct *hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+  struct hppa_fix_struct *hppa_fix = XOBNEW (&notes, struct hppa_fix_struct);
 
   if (exp != NULL)
     new_fix = fix_new_exp (frag, where, size, exp, pcrel, r_type);
@@ -8556,7 +8556,7 @@ pa_vtable_entry (int ignore ATTRIBUTE_UNUSED)
 
   if (new_fix)
     {
-      struct hppa_fix_struct * hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+      struct hppa_fix_struct * hppa_fix = XOBNEW (&notes, struct hppa_fix_struct);
 
       hppa_fix->fx_r_type = R_HPPA;
       hppa_fix->fx_r_field = e_fsel;
@@ -8577,7 +8577,7 @@ pa_vtable_inherit (int ignore ATTRIBUTE_UNUSED)
 
   if (new_fix)
     {
-      struct hppa_fix_struct * hppa_fix = obstack_alloc (&notes, sizeof (struct hppa_fix_struct));
+      struct hppa_fix_struct * hppa_fix = XOBNEW (&notes, struct hppa_fix_struct);
 
       hppa_fix->fx_r_type = R_HPPA;
       hppa_fix->fx_r_field = e_fsel;
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index bd6eac6..8d5a8d7 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -4615,7 +4615,7 @@ md_begin (void)
   obstack_begin (&robyn, 4000);
   for (i = 0; i < m68k_numopcodes; i++)
     {
-      hack = slak = obstack_alloc (&robyn, sizeof (struct m68k_incant));
+      hack = slak = XOBNEW (&robyn, struct m68k_incant);
       do
 	{
 	  ins = m68k_sorted_opcodes[i];
@@ -4645,7 +4645,7 @@ md_begin (void)
 	  if (i + 1 != m68k_numopcodes
 	      && !strcmp (ins->name, m68k_sorted_opcodes[i + 1]->name))
 	    {
-	      slak->m_next = obstack_alloc (&robyn, sizeof (struct m68k_incant));
+	      slak->m_next = XOBNEW (&robyn, struct m68k_incant);
 	      i++;
 	    }
 	  else
@@ -4762,7 +4762,7 @@ md_begin (void)
 
     while (mote_pseudo_table[n].poc_name)
       {
-	hack = obstack_alloc (&robyn, sizeof (struct m68k_incant));
+	hack = XOBNEW (&robyn, struct m68k_incant);
 	hash_insert (op_hash,
 		     mote_pseudo_table[n].poc_name, (char *) hack);
 	hack->m_operands = 0;
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] replace some obstack_alloc () calls with the XOBNEW wrapper
  2016-03-28 23:56 [PATCH] replace some obstack_alloc () calls with the XOBNEW wrapper tbsaunde+binutils
@ 2016-03-29  8:42 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2016-03-29  8:42 UTC (permalink / raw)
  To: tbsaunde+binutils; +Cc: binutils

On Mon, Mar 28, 2016 at 08:01:09PM -0400, tbsaunde+binutils@tbsaunde.org wrote:
> 	* config/tc-bfin.c (gencode): Use XOBNEW obstack_alloc () wrapper.
> 	* config/tc-hppa.c (fix_new_hppa): Likewise.
> 	(pa_vtable_entry): Likewise.
> 	(pa_vtable_inherit): Likewise.
> 	* config/tc-m68k.c (md_begin): Likewise.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-29  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 23:56 [PATCH] replace some obstack_alloc () calls with the XOBNEW wrapper tbsaunde+binutils
2016-03-29  8:42 ` Alan Modra

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