From: Timm Bäder Date: Mon, 23 Nov 2020 12:27:07 +0000 (+0100) Subject: segment_report_module: Get rid of nested final_read() function X-Git-Tag: elfutils-0.183~82 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43209878bd6786abee3ac80cf6f04c7c083c3505;p=thirdparty%2Felfutils.git segment_report_module: Get rid of nested final_read() function Signed-off-by: Timm Bäder --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 19c78e4ff..59685851a 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2020-11-23 Timm Bäder + + * segment_report_module.c (dwfl_segment_report_module): Remove + final_read, call memory_callback directly. + 2020-11-23 Timm Bäder * segment_report_module.c (struct elf_build_id): New. diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index af8c6b596..b68089fd7 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -900,15 +900,6 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, if (unlikely (contents == NULL)) goto out; - inline void final_read (size_t offset, GElf_Addr vaddr, size_t size) - { - void *into = contents + offset; - size_t read_size = size; - (*memory_callback) (dwfl, addr_segndx (dwfl, segment, vaddr, false), - &into, &read_size, vaddr, size, - memory_callback_arg); - } - if (contiguous < file_trimmed_end) { /* We can't use the memory image verbatim as the file image. @@ -918,7 +909,15 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, GElf_Off offset, GElf_Xword filesz) { if (type == PT_LOAD) - final_read (offset, vaddr + bias, filesz); + { + void *into = contents + offset; + size_t read_size = filesz; + (*memory_callback) (dwfl, + addr_segndx (dwfl, segment, + vaddr + bias, false), + &into, &read_size, vaddr + bias, + read_size, memory_callback_arg); + } } if (ei_class == ELFCLASS32) @@ -939,7 +938,15 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, memcpy (contents, buffer, have); if (have < file_trimmed_end) - final_read (have, start + have, file_trimmed_end - have); + { + void *into = contents + have; + size_t read_size = file_trimmed_end - have; + (*memory_callback) (dwfl, + addr_segndx (dwfl, segment, + start + have, false), + &into, &read_size, start + have, + read_size, memory_callback_arg); + } } elf = elf_memory (contents, file_trimmed_end);