Does the new walk_children look right to you?
That style is similar to what I would use when I need to factor out code in
large C functions. It should be general enough to replace all nested
functions in elfutils.
The general style of factoring out the shared locals into by-reference
parameters of the subfunction is right. How much to put into a bespoke
local struct and how much to do with multiple parameters is a case by case
decision about what feels most clean and concise in the source code.
I don't favor typedefs for private types like that. Just use 'struct foo'.
Some of the indentation choices and other style nits didn't look quite
right off hand, but those are trivia.