public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: tbaeder@redhat.com
To: elfutils-devel@sourceware.org
Subject: [PATCH 07/12] segment_report_module: Get rid of nested final_read() function
Date: Mon, 23 Nov 2020 13:27:07 +0100	[thread overview]
Message-ID: <20201123122712.3799676-8-tbaeder@redhat.com> (raw)
In-Reply-To: <20201123122712.3799676-1-tbaeder@redhat.com>

From: Timm Bäder <tbaeder@redhat.com>

Signed-off-by: Timm Bäder <tbaeder@redhat.com>
---
 libdwfl/dwfl_segment_report_module.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 6c6f9f37..a69ead8f 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -934,15 +934,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.
@@ -952,7 +943,13 @@ 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)
@@ -973,7 +970,13 @@ 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);
-- 
2.26.2


  parent reply	other threads:[~2020-11-23 12:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 12:27 Remove nested functions from libdwfl V2 tbaeder
2020-11-23 12:27 ` [PATCH 01/12] segment_report_module: Get rid of segment_read() tbaeder
2020-11-23 12:27 ` [PATCH 02/12] segment_report_module: Remove nested release_buffer() function tbaeder
2020-11-23 12:27 ` [PATCH 03/12] segment_report_module: Pull finish_portion() info file scope tbaeder
2020-11-23 12:27 ` [PATCH 04/12] segment_report_module: Pull read_portion() into " tbaeder
2020-11-23 12:27 ` [PATCH 05/12] segment_report_module: Use a struct for build id information tbaeder
2020-11-23 12:27 ` [PATCH 06/12] segment_report_module: Pull consider_notes() into file scope tbaeder
2020-11-23 12:27 ` tbaeder [this message]
2020-11-23 12:27 ` [PATCH 08/12] segment_report_module: Use one loop for p32/p64 arrays tbaeder
2020-11-23 12:27 ` [PATCH 09/12] segment_report_module: Inline read_phdr() into only caller tbaeder
2020-11-23 12:27 ` [PATCH 10/12] segment_report_module: Unify d32/d64 loops tbaeder
2020-11-23 12:27 ` [PATCH 11/12] segment_report_module: Inline consider_dyn() into only caller tbaeder
2020-11-23 12:27 ` [PATCH 12/12] segment_report_module: Inline consider_phdr() " tbaeder
2020-11-25 16:33 ` Remove nested functions from libdwfl V2 Mark Wielaard
2020-11-26 11:31   ` Timm Bäder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201123122712.3799676-8-tbaeder@redhat.com \
    --to=tbaeder@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).