This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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] Code cleanup: Simplify binary_search_fde


Hi,

this change has no effect on functionality, it just makes the code less magic.


Thanks,
Jan


libdw/
2012-10-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Code cleanup.
	* fde.c (binary_search_fde): Remove always true <address >= start>
	conditional.  Move L initialization upwards.

diff --git a/libdw/fde.c b/libdw/fde.c
index d366768..bde0c99 100644
--- a/libdw/fde.c
+++ b/libdw/fde.c
@@ -181,32 +181,30 @@ binary_search_fde (Dwarf_CFI *cache, Dwarf_Addr address)
 	u = idx;
       else
 	{
+	  l = idx + 1;
+
 	  Dwarf_Addr fde;
 	  if (unlikely (read_encoded_value (&dummy_cfi,
 					    cache->search_table_encoding, &p,
 					    &fde)))
 	    break;
-	  if (address >= start)
+
+	  /* If this is the last entry, its upper bound is assumed to be
+	     the end of the module.
+	     XXX really should be end of containing PT_LOAD segment */
+	  if (l < cache->search_table_entries)
 	    {
-	      l = idx + 1;
-
-	      /* If this is the last entry, its upper bound is assumed to be
-		 the end of the module.
-		 XXX really should be end of containing PT_LOAD segment */
-	      if (l < cache->search_table_entries)
-		{
-		  /* Look at the start address in the following entry.  */
-		  Dwarf_Addr end;
-		  if (unlikely (read_encoded_value
-				(&dummy_cfi, cache->search_table_encoding, &p,
-				 &end)))
-		    break;
-		  if (address >= end)
-		    continue;
-		}
-
-	      return fde - cache->frame_vaddr;
+	      /* Look at the start address in the following entry.  */
+	      Dwarf_Addr end;
+	      if (unlikely (read_encoded_value
+			    (&dummy_cfi, cache->search_table_encoding, &p,
+			     &end)))
+		break;
+	      if (address >= end)
+		continue;
 	    }
+
+	  return fde - cache->frame_vaddr;
 	}
     }
 

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