This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Short circuit bfd_map_over_sections
On Thu, Apr 29, 2004 at 08:12:39PM -0400, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > bfd_map_over_sections is used to call a function on each section in
> > a bfd. However, there are many places where bfd_map_over_sections
> > is called to find something. It isn't necessary to go through all
> > sections once it is found. I'd like to modify bfd_map_over_sections to
> >
> > void
> > bfd_map_over_sections (bfd *abfd,
> > bfd_boolean (*operation) (bfd *, asection *, void *),
> > void *user_storage)
> > {
> > asection *sect;
> >
> > for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
> > if (!(*operation) (abfd, sect, user_storage))
> > break;
> > }
> >
> > Any comments?
>
> I don't think it would be wise to change bfd_map_over_sections at this
> point. It is widely used, including by GDB. A lot of code would have
> to changed to have the function argument return true.
>
> I think that, unfortunately, we should add a new function for this.
>
That is fine. What should we call it? bfd_run_over_sections,
bfd_call_over_sections, bfd_call_on_sections, ...
H.J.