]> git.ipfire.org Git - thirdparty/elfutils.git/commit
readelf: Pass around GElf_Ehdr instead of calling gelf_getehdr
authorMark Wielaard <mark@klomp.org>
Tue, 29 Apr 2025 21:19:47 +0000 (23:19 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 29 Apr 2025 21:19:47 +0000 (23:19 +0200)
commit56e7a862d82e646bae79706343afa5f7800e2be1
tree999eac2501c6c3d920c71f57b88793c505c3a188
parent04839d5826d21e7a603a76fddc7afed6d32ab087
readelf: Pass around GElf_Ehdr instead of calling gelf_getehdr

handle_core_item calls gelf_getehdr for each item without checking if
the call succeeds. It should always succeed because process_elf_file
already checked gelf_getehdr returned a valid Ehdr before passing it
to handle_notes. Just pass the Ehdr down a couple more function calls.

* readelf.c (handle_core_item): Take const Gelf_Ehdr and use it.
(handle_core_items): Take const Gelf_Ehdr and pass it to
handle_core_item.
(handle_core_note): Take const Gelf_Ehdr and pass it to
handle_core_items.
(handle_notes_data): Pass ehdr to handle_core_note.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/readelf.c