From bc87dd2ec11aaeda576515604b008776612f2261 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 30 Apr 2004 15:01:15 +0000 Subject: [PATCH] 2004-04-30 H.J. Lu * section.c (bfd_sections_find_if): New. * bfd-in2.h: Regenerated. --- bfd/ChangeLog | 5 +++++ bfd/bfd-in2.h | 5 +++++ bfd/section.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 74bc2cc..1a431da 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2004-04-30 H.J. Lu + + * section.c (bfd_sections_find_if): New. + * bfd-in2.h: Regenerated. + 2004-04-30 Alan Modra * section.c (bfd_make_section_anyway): Add all sections to hash tab. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ed45cac..5843a19 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1450,6 +1450,11 @@ void bfd_map_over_sections void (*func) (bfd *abfd, asection *sect, void *obj), void *obj); +asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); + bfd_boolean bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); diff --git a/bfd/section.c b/bfd/section.c index 5ecb4a6..0236f08 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1096,6 +1096,41 @@ bfd_map_over_sections (bfd *abfd, /* FUNCTION + bfd_sections_find_if + +SYNOPSIS + asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); + +DESCRIPTION + Call the provided function @var{func} for each section + attached to the BFD @var{abfd}, passing @var{obj} as an + argument. The function will be called as if by + +| func (abfd, the_section, obj); + + It returns the first section for which @var{func} returns true. + +*/ + +asection * +bfd_sections_find_if (bfd *abfd, + bfd_boolean (*operation) (bfd *, asection *, void *), + void *user_storage) +{ + asection *sect; + + for (sect = abfd->sections; sect != NULL; sect = sect->next) + if ((*operation) (abfd, sect, user_storage)) + break; + + return sect; +} + +/* +FUNCTION bfd_set_section_size SYNOPSIS -- 2.7.4