public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Code cleanup in bfd/reloc.c
@ 2003-05-14  5:06 Thiemo Seufer
  2003-05-16  9:49 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Thiemo Seufer @ 2003-05-14  5:06 UTC (permalink / raw)
  To: binutils

Hello All,

this does a bit of code cleanup.


Thiemo


2003-05-14  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/bfd/ChangeLog
	* reloc.c (bfd_install_relocation): Code cleanup.


diff -BurpNX /bigdisk/src/gcc-exclude source-orig/bfd/reloc.c source/bfd/reloc.c
--- source-orig/bfd/reloc.c	Fri Apr 25 07:35:26 2003
+++ source/bfd/reloc.c	Mon May  5 00:51:20 2003
@@ -987,7 +987,7 @@ bfd_install_relocation (abfd, reloc_entr
      char **error_message;
 {
   bfd_vma relocation;
-  bfd_reloc_status_type flag = bfd_reloc_ok;
+  bfd_reloc_status_type flag;
   bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
   bfd_vma output_base = 0;
   reloc_howto_type *howto = reloc_entry->howto;
@@ -1007,17 +1007,15 @@ bfd_install_relocation (abfd, reloc_entr
      can be done.  */
   if (howto->special_function)
     {
-      bfd_reloc_status_type cont;
-
       /* XXX - The special_function calls haven't been fixed up to deal
 	 with creating new relocations and section contents.  */
-      cont = howto->special_function (abfd, reloc_entry, symbol,
+      flag = howto->special_function (abfd, reloc_entry, symbol,
 				      /* XXX - Non-portable! */
 				      ((bfd_byte *) data_start
 				       - data_start_offset),
 				      input_section, abfd, error_message);
-      if (cont != bfd_reloc_continue)
-	return cont;
+      if (flag != bfd_reloc_continue)
+	return flag;
     }
 
   /* Is the address of the relocation really within the section?  */
@@ -1094,7 +1096,7 @@ bfd_install_relocation (abfd, reloc_entr
 	 inplace to reflect what we now know.  */
       reloc_entry->addend = relocation;
       reloc_entry->address += input_section->output_offset;
-      return flag;
+      return bfd_reloc_ok;
     }
   else
     {
@@ -1202,6 +1204,8 @@ space consuming.  For each target:
 			       howto->rightshift,
 			       bfd_arch_bits_per_address (abfd),
 			       relocation);
+  else
+    flag = bfd_reloc_ok;
 
   /* Either we are relocating all the way, or we don't want to apply
      the relocation to the reloc entry (probably because there isn't

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

* Re: [PATCH] Code cleanup in bfd/reloc.c
  2003-05-14  5:06 [PATCH] Code cleanup in bfd/reloc.c Thiemo Seufer
@ 2003-05-16  9:49 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2003-05-16  9:49 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

Hi Thiemo,

> this does a bit of code cleanup.

I am not sure of the point of this code cleanup.

It seems to me that the code is basically OK as it stands at the
moment.  I appreciate that the patch reduces the number of lines and
variables when handling the 'special_function' but I do not like
eliminating the intialisation of 'flag' at the start of the function
and then being forced to add an else clause to the if statement at
line 1199, and an explicit return at 1907.

Cheers
        Nick

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

end of thread, other threads:[~2003-05-16  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14  5:06 [PATCH] Code cleanup in bfd/reloc.c Thiemo Seufer
2003-05-16  9:49 ` Nick Clifton

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