]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
segment_report_module: Get rid of nested final_read() function
authorTimm Bäder <tbaeder@redhat.com>
Mon, 23 Nov 2020 12:27:07 +0000 (13:27 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 25 Nov 2020 15:22:14 +0000 (16:22 +0100)
Signed-off-by: Timm Bäder <tbaeder@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_segment_report_module.c

index 19c78e4ff7a2506dbc14c45b32fd42ad372aa37c..59685851a9a50951ade2bd13bc0c6a489cb0276b 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-23  Timm Bäder  <tbaeder@redhat.com>
+
+       * segment_report_module.c (dwfl_segment_report_module): Remove
+       final_read, call memory_callback directly.
+
 2020-11-23  Timm Bäder  <tbaeder@redhat.com>
 
        * segment_report_module.c (struct elf_build_id): New.
index af8c6b59678ce8174c74758f4a68a0ab1c30e68a..b68089fd716f0cef3a66aa1dfce53c6422dd2f7a 100644 (file)
@@ -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);