Remove nested functions from libdwfl V2

Timm Bäder
Thu Nov 26 11:31:49 GMT 2020

On 25/11/2020 17:33, Mark Wielaard wrote:
> Hi Timm,
> On Mon, 2020-11-23 at 13:27 +0100, Timm Bäder via Elfutils-devel wrote:
>> version 2 of this patch set. I removed segmend_read() entirely now,
>> which meant modifying a bunch of later patches. Other than that, they
>> are the same.
>> Hope the --from to git send-email worked out, too.
> It did, thanks.
> I immediately picked up 9 of these patches that clearly looked like
> they improved the code. I added ChangeLog entries and might have
> slightly tweaked the large lines to be a little shorter (also fixed up
> some tab vs space indents, but the file wasn't really consistent to
> begin with).
> The last three I skipped for now were:
> - segment_report_module: Pull finish_portion() info file scope
> - segment_report_module: Pull read_portion() into file scope
> - segment_report_module: Pull consider_notes() into file scope
> The first two aren't so bad, but maybe we can find a way to not pass so
> many arguments around (have a state struct with dwfl,
> memory_callback[_arg], data and size maybe?)

I also initially did the state struct, i.e.

struct read_state
   Dwfl *dwfl;
   Dwfl_Memory_Callback *memory_callback;
   void *memory_callback_arg;
   void **buffer;
   size_t *buffer_available;

but we usually pass a data+data_size pair around separately. I now have
a patch with this struct anyway.

> consider_notes might be better just inlined because it is used only
> once.

Saw that now too and inlined it.

I'll send the patches soon.


Red Hat GmbH,, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael O'Neill, Tom Savage, Eric 

More information about the Elfutils-devel mailing list