]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
derelocate.c (cache_sections): Intern mod->reloc_info check.
authorMark Wielaard <mjw@redhat.com>
Thu, 20 Oct 2011 14:53:54 +0000 (16:53 +0200)
committerMark Wielaard <mjw@redhat.com>
Thu, 20 Oct 2011 14:53:54 +0000 (16:53 +0200)
libdwfl/ChangeLog
libdwfl/derelocate.c

index c2e126a653504b7228d8888162df6006ab28fe76..adf3efac45354d3b30b5ca947ed6ea3f6ee4be10 100644 (file)
@@ -1,3 +1,10 @@
+2011-10-20  Mark Wielaard  <mjw@redhat.com>
+
+       * derelocate.c (cache_sections): Intern mod->reloc_info check.
+       (dwfl_module_relocations): Don't check mod->reloc_info.
+       (dwfl_module_relocation_info): Likewise.
+       (find_section): Likewise.
+
 2011-07-09  Roland McGrath  <roland@hack.frob.com>
 
        * image-header.c (LE32): Macro removed (now in lib/system.h).
index ba6d9db4dc1d9a730bde59bf879f7a245ec9b5b8..b8c8dd73a5127bb9110867d229b3e523d384e474 100644 (file)
@@ -90,6 +90,9 @@ compare_secrefs (const void *a, const void *b)
 static int
 cache_sections (Dwfl_Module *mod)
 {
+  if (likely (mod->reloc_info != NULL))
+    return mod->reloc_info->count;
+
   struct secref *refs = NULL;
   size_t nrefs = 0;
 
@@ -227,9 +230,6 @@ dwfl_module_relocations (Dwfl_Module *mod)
   if (mod == NULL)
     return -1;
 
-  if (mod->reloc_info != NULL)
-    return mod->reloc_info->count;
-
   switch (mod->e_type)
     {
     case ET_REL:
@@ -269,7 +269,7 @@ dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx,
       return NULL;
     }
 
-  if (unlikely (mod->reloc_info == NULL) && cache_sections (mod) < 0)
+  if (cache_sections (mod) < 0)
     return NULL;
 
   struct dwfl_relocation *sections = mod->reloc_info;
@@ -318,7 +318,7 @@ check_module (Dwfl_Module *mod)
 static int
 find_section (Dwfl_Module *mod, Dwarf_Addr *addr)
 {
-  if (unlikely (mod->reloc_info == NULL) && cache_sections (mod) < 0)
+  if (cache_sections (mod) < 0)
     return -1;
 
   struct dwfl_relocation *sections = mod->reloc_info;