This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

[PATCH] MIPS gas: Initialiize variables with zeros


Hello All,

this initializes reloc correctly (reloc->howto was left alone before)
and cleans up the retval initialization.


Thiemo


2003-06-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (tc_gen_reloc): Initialize retval amd reloc
	with zeros.


diff -urpNX /bigdisk/src/gcc-exclude source-orig/gas/config/tc-mips.c source/gas/config/tc-mips.c
--- source-orig/gas/config/tc-mips.c	Tue Jun 10 17:05:26 2003
+++ source/gas/config/tc-mips.c	Tue Jun 10 19:19:51 2003
@@ -13751,9 +13690,8 @@ tc_gen_reloc (section, fixp)
   arelent *reloc;
   bfd_reloc_code_real_type code;
 
-  reloc = retval[0] = (arelent *) xmalloc (sizeof (arelent));
-  retval[1] = NULL;
-
+  memset (retval, 0, sizeof(retval));
+  reloc = retval[0] = (arelent *) xcalloc (1, sizeof (arelent));
   reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -13858,7 +13796,6 @@ tc_gen_reloc (section, fixp)
       reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
       reloc->addend += fixp->fx_frag->tc_frag_data.tc_fr_offset;
       reloc2 = retval[1] = (arelent *) xmalloc (sizeof (arelent));
-      retval[2] = NULL;
       reloc2->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
       *reloc2->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
       reloc2->address = (reloc->address
@@ -13874,7 +13811,6 @@ tc_gen_reloc (section, fixp)
 	  arelent *reloc3;
 
 	  reloc3 = retval[2] = (arelent *) xmalloc (sizeof (arelent));
-	  retval[3] = NULL;
 	  *reloc3 = *reloc2;
 	  reloc3->address += 4;
 	}


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