]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
__libdwfl_find_build_id optimization nit
authorRoland McGrath <roland@redhat.com>
Tue, 10 Mar 2009 03:49:53 +0000 (20:49 -0700)
committerRoland McGrath <roland@redhat.com>
Tue, 10 Mar 2009 03:49:53 +0000 (20:49 -0700)
libdwfl/ChangeLog
libdwfl/dwfl_module_build_id.c

index ef718266509498db52b45c9f0d62b41cbcd1cb68..d420e3c9ddb4a8973bfe141acb69decdf9dacdf0 100644 (file)
@@ -1,5 +1,8 @@
 2009-03-09  Roland McGrath  <roland@redhat.com>
 
+       * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX
+       variable to outer scope, so we cache it for the loop.
+
        * relocate.c (__libdwfl_relocate_value): Add MOD->main.bias to sh_addr.
 
 2009-02-12  Roland McGrath  <roland@redhat.com>
index 5d196a9d91720f57cf637bc7a92530663067906a..f3fcc190ee319c5e676ce211d387e42477fd346e 100644 (file)
@@ -97,6 +97,7 @@ int
 internal_function
 __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
 {
+  size_t shstrndx = SHN_UNDEF;
   int result = 0;
 
   Elf_Scn *scn = elf_nextscn (elf, NULL);
@@ -132,7 +133,6 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
        if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE)
          {
            /* Determine the right sh_addr in this module.  */
-           size_t shstrndx = SHN_UNDEF;
            GElf_Addr vaddr = 0;
            if (!(shdr->sh_flags & SHF_ALLOC)
                || __libdwfl_relocate_value (mod, elf, &shstrndx,