[PATCH 04/14] segment_report_module: Remove nested release_buffer() function

Mark Wielaard mark@klomp.org
Thu Nov 19 11:24:26 GMT 2020


Hi Timm,

On Thu, 2020-11-12 at 16:04 +0100, Timm Bäder via Elfutils-devel wrote:
> diff --git a/libdwfl/dwfl_segment_report_module.c
> b/libdwfl/dwfl_segment_report_module.c
> index d06d0ba0..ba11b60a 100644
> --- a/libdwfl/dwfl_segment_report_module.c
> +++ b/libdwfl/dwfl_segment_report_module.c
> @@ -267,13 +267,6 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
>  
>    GElf_Addr start = dwfl->lookup_addr[segment];
>  
> -  inline void release_buffer (void **buffer, size_t *buffer_available)
> -  {
> -    if (*buffer != NULL)
> -      (void) segment_read (dwfl, memory_callback, memory_callback_arg,
> -                           -1, buffer, buffer_available, 0, 0);
> -  }

This depends on [PATCH 02/14] segment_report_module: Pull segment_read
into file scope. For which I rather see us use a direct call to
(*memory_callback). And release_buffer is basically segment_read (with
a *buffer != NULL check), which is basically a (*memory_callback) call.
So if possible I rather see us use something like:
  if (*buffer != NULL) (*memory_callback) (...)
directly.

Thanks,

Mark


More information about the Elfutils-devel mailing list