forked from Imagelibrary/binutils-gdb
Re: Keeping track of rs6000-coff archive element pointers
bfd/ * coff-rs6000.c (add_range): Revise comment, noting possible fail. (_bfd_xcoff_openr_next_archived_file): Start with clean ranges. binutils/ * bfdtest1.c: Enhance to catch errors on second scan.
This commit is contained in:
@@ -33,6 +33,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
bfd *archive;
|
||||
bfd *last, *next;
|
||||
int count;
|
||||
|
||||
if (argc != 2)
|
||||
die ("usage: bfdtest1 <archive>");
|
||||
@@ -47,12 +48,13 @@ main (int argc, char **argv)
|
||||
die ("bfd_check_format");
|
||||
}
|
||||
|
||||
for (last = bfd_openr_next_archived_file (archive, NULL);
|
||||
for (count = 0, last = bfd_openr_next_archived_file (archive, NULL);
|
||||
last;
|
||||
last = next)
|
||||
{
|
||||
next = bfd_openr_next_archived_file (archive, last);
|
||||
bfd_close (last);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (last = bfd_openr_next_archived_file (archive, NULL);
|
||||
@@ -61,8 +63,12 @@ main (int argc, char **argv)
|
||||
{
|
||||
next = bfd_openr_next_archived_file (archive, last);
|
||||
bfd_close (last);
|
||||
count--;
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
die ("element count differs in second scan");
|
||||
|
||||
if (!bfd_close (archive))
|
||||
die ("bfd_close");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user