[PATCH 02/14] segment_report_module: Pull segment_read into file scope

Mark Wielaard mark@klomp.org
Wed Nov 18 23:18:14 GMT 2020

Hi Timm,

On Thu, Nov 12, 2020 at 04:04:00PM +0100, Timm Bäder via Elfutils-devel wrote:
> In preparation of getting rid of nested functions

I actually like the nested functions in this case, they simply act as
lambdas. But if you want to get rid of this one then can we inline
the (*memory_callback) (dwfl, segndx, buffer, buffer_available, ...)
call instead of introducing a new top-level function that shuffles the
arguments around?

So instead of:

> -  if (segment_read (ndx, &buffer, &buffer_available,
> +  if (segment_read (dwfl, memory_callback, memory_callback_arg,
> +                    ndx, &buffer, &buffer_available,
>  		    start, sizeof (Elf64_Ehdr))


  if (! (*memory_callback) (dwfl, ndx, &buffer, &buffer_available,
      			    start, sizeof (Elf64_Ehdr), memory_callback_arg))



More information about the Elfutils-devel mailing list