diff options
Diffstat (limited to 'bfd/section.c')
-rw-r--r-- | bfd/section.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/bfd/section.c b/bfd/section.c index 45ede06..3f008ea 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -552,10 +552,7 @@ CODE_FRAGMENT . else \ . (ABFD)->sections = _next; \ . if (_next) \ -. { \ -. _next->prev = _prev; \ -. _s->next = NULL; \ -. } \ +. _next->prev = _prev; \ . else \ . (ABFD)->section_last = _prev; \ . } \ @@ -572,10 +569,32 @@ CODE_FRAGMENT . _abfd->section_last->next = _s; \ . } \ . else \ -. _abfd->sections = _s; \ +. { \ +. _s->prev = NULL; \ +. _abfd->sections = _s; \ +. } \ . _abfd->section_last = _s; \ . } \ . while (0) +.#define bfd_section_list_prepend(ABFD, S) \ +. do \ +. { \ +. asection *_s = S; \ +. bfd *_abfd = ABFD; \ +. _s->prev = NULL; \ +. if (_abfd->sections) \ +. { \ +. _s->next = _abfd->sections; \ +. _abfd->sections->prev = _s; \ +. } \ +. else \ +. { \ +. _s->next = NULL; \ +. _abfd->section_last = _s; \ +. } \ +. _abfd->sections = _s; \ +. } \ +. while (0) .#define bfd_section_list_insert_after(ABFD, A, S) \ . do \ . { \ @@ -586,7 +605,7 @@ CODE_FRAGMENT . _s->prev = _a; \ . _a->next = _s; \ . if (_next) \ -. _s->next->prev = _s; \ +. _next->prev = _s; \ . else \ . (ABFD)->section_last = _s; \ . } \ @@ -607,7 +626,7 @@ CODE_FRAGMENT . } \ . while (0) .#define bfd_section_removed_from_list(ABFD, S) \ -. ((S)->next == NULL && (S) != (ABFD)->section_last) +. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) . */ |