From 04dd1667401316be04feb97696399d0728b63bf6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 3 May 2005 17:05:51 +0000 Subject: * section.c (bfd_section_list_remove): Don't clear s->next. (bfd_section_list_append): Always init s->prev. (bfd_section_list_prepend): Define. (bfd_section_list_insert_after): Minor optimization. (bfd_section_removed_from_list): Rewrite. * elf.c (assign_section_numbers): Simplify list traversal now that bfd_section_list_remove doesn't destroy removed section next ptr. * sunos.c (sunos_add_dynamic_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_object_p): Use bfd_section_list_prepend. * xcofflink.c (_bfd_xcoff_bfd_final_link): Simplify list traversal. * bfd-in2.h: Regenerate. --- bfd/xcofflink.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'bfd/xcofflink.c') diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 127ac3d..c72507e 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -5436,19 +5436,18 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { bfd_boolean saw_contents; int indx; - asection **op; file_ptr sofar; /* Insert .pad sections before every section which has contents and is loaded, if it is preceded by some other section which has contents and is loaded. */ saw_contents = TRUE; - for (op = &abfd->sections; *op != NULL; op = &(*op)->next) + for (o = abfd->sections; o != NULL; o = o->next) { - if (strcmp ((*op)->name, ".pad") == 0) + if (strcmp (o->name, ".pad") == 0) saw_contents = FALSE; - else if (((*op)->flags & SEC_HAS_CONTENTS) != 0 - && ((*op)->flags & SEC_LOAD) != 0) + else if ((o->flags & SEC_HAS_CONTENTS) != 0 + && (o->flags & SEC_LOAD) != 0) { if (! saw_contents) saw_contents = TRUE; @@ -5465,9 +5464,7 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) n->alignment_power = 0; bfd_section_list_remove (abfd, n); - bfd_section_list_insert_before (abfd, *op, n); - - op = &n->next; + bfd_section_list_insert_before (abfd, o, n); saw_contents = FALSE; } } -- cgit v1.1