diff options
author | Mark Wielaard <mjw@redhat.com> | 2011-10-20 16:53:54 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2011-10-20 16:53:54 +0200 |
commit | f43feb5146788052eb3f43174e0b1a6638155a0a (patch) | |
tree | d102022dbf8e5ed47143b308771834b231949c41 /libdwfl/derelocate.c | |
parent | e9bf1d30e7fd35cbe11c6586500cab11a1d91918 (diff) | |
download | elfutils-f43feb5146788052eb3f43174e0b1a6638155a0a.tar.gz |
derelocate.c (cache_sections): Intern mod->reloc_info check.
Diffstat (limited to 'libdwfl/derelocate.c')
-rw-r--r-- | libdwfl/derelocate.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c index ba6d9db4..b8c8dd73 100644 --- a/libdwfl/derelocate.c +++ b/libdwfl/derelocate.c @@ -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; |