[PATCH 11/14] segment_report_module: Inline read_phdr() into only caller
Timm Bäder
tbaeder@redhat.com
Thu Nov 12 15:04:09 GMT 2020
There is now only one caller for this nested function, so get rid of it
by just inlining it there.
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
---
libdwfl/dwfl_segment_report_module.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 2535f9e3..bcf69fe7 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -952,30 +952,23 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
{
/* We can't use the memory image verbatim as the file image.
So we'll be reading into a local image of the virtual file. */
-
- inline void read_phdr (GElf_Word type, GElf_Addr vaddr,
- GElf_Off offset, GElf_Xword filesz)
- {
- if (type == PT_LOAD)
- {
- void *into = contents + offset;
- size_t read_size = filesz;
- (void)segment_read (dwfl, memory_callback, memory_callback_arg,
- addr_segndx (dwfl, segment, vaddr + bias, false),
- &into, &read_size, vaddr + bias, read_size);
-
- }
- }
-
for (uint_fast16_t i = 0; i < phnum; ++i)
{
bool is32 = (ei_class == ELFCLASS32);
GElf_Word type = is32 ? p32[i].p_type : p64[i].p_type;
+
+ if (type != PT_LOAD)
+ continue;
+
GElf_Addr vaddr = is32 ? p32[i].p_vaddr : p64[i].p_vaddr;
GElf_Off offset = is32 ? p32[i].p_offset : p64[i].p_offset;
GElf_Xword filesz = is32 ? p32[i].p_filesz : p64[i].p_filesz;
- read_phdr (type, vaddr, offset, filesz);
+ void *into = contents + offset;
+ size_t read_size = filesz;
+ (void)segment_read (dwfl, memory_callback, memory_callback_arg,
+ addr_segndx (dwfl, segment, vaddr + bias, false),
+ &into, &read_size, vaddr + bias, read_size);
}
}
else
--
2.26.2
More information about the Elfutils-devel
mailing list