return prev;
}
-/* To be called by backends only */
+/* To be called by backends only. */
bfd *
_bfd_create_empty_archive_element_shell (bfd *obfd)
return NULL;
}
-/* Kind of stupid to call cons for each one, but we don't do too many */
+/* Kind of stupid to call cons for each one, but we don't do too many. */
+
bfd_boolean
_bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
{
Presumes the file pointer is already in the right place (ie pointing
to the ar_hdr in the file). Moves the file pointer; on success it
should be pointing to the front of the file contents; on failure it
- could have been moved arbitrarily.
-*/
+ could have been moved arbitrarily. */
void *
_bfd_generic_read_ar_hdr (bfd *abfd)
/* The size of the string count. */
#define BSD_STRING_COUNT_SIZE 4
-/* Returns FALSE on error, TRUE otherwise */
+/* Returns FALSE on error, TRUE otherwise. */
static bfd_boolean
do_slurp_bsd_armap (bfd *abfd)
return TRUE;
}
\f
-/* Returns FALSE on error, TRUE otherwise */
-/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
+/* Returns FALSE on error, TRUE otherwise. */
+/* Flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
header is in a slightly different order and the map name is '/'.
This flavour is used by hp300hpux. */
return FALSE;
if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
+ || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
if (strncmp (nextname, "/ ", 16))
return TRUE;
}
\f
-/** A couple of functions for creating ar_hdrs */
+/* A couple of functions for creating ar_hdrs. */
#ifdef HPUX_LARGE_AR_IDS
/* Function to encode large UID/GID values according to HP. */
bfd *current;
file_ptr elt_no = 0;
struct orl *map = NULL;
- unsigned int orl_max = 1024; /* fine initial default */
+ unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
- int stridx = 0; /* string index */
+ int stridx = 0;
asymbol **syms = NULL;
long syms_max = 0;
bfd_boolean ret;
unsigned int mapsize = ranlibsize + stringsize + 8;
file_ptr firstreal;
bfd *current = arch->archive_head;
- bfd *last_elt = current; /* last element arch seen */
+ bfd *last_elt = current; /* Last element arch seen. */
bfd_byte temp[4];
unsigned int count;
struct ar_hdr hdr;
current = current->next;
}
while (current != map[count].u.abfd);
- } /* if new archive element */
+ }
last_elt = current;
H_PUT_32 (arch, map[count].namidx, buf);
symbol name 0
symbol name 1
- symbol name n-1
-*/
+ symbol name n-1 */
bfd_boolean
coff_write_armap (bfd *arch,
(((char *) (&hdr))[i]) = ' ';
/* Write the ar header for this item and the number of symbols. */
-
if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;
otherwise, it has to perform the complicated lookup function.
.#define bfd_cache_lookup(x) \
- . ((x)==bfd_last_cache? \
- . (FILE*) (bfd_last_cache->iostream): \
- . bfd_cache_lookup_worker(x))
+ . ((x) == bfd_last_cache ? \
+ . (FILE *) (bfd_last_cache->iostream): \
+ . bfd_cache_lookup_worker (x))
*/
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
- avoid running out of file descriptors.
+ avoid running out of file descriptors. It will abort rather than
+ returning NULL if it is unable to (re)open the @var{abfd}.
*/
FILE *
}
else
{
- if (bfd_open_file (abfd) == NULL)
- return NULL;
- if (abfd->where != (unsigned long) abfd->where)
- return NULL;
- if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
- return NULL;
+ if (bfd_open_file (abfd) == NULL
+ || abfd->where != (unsigned long) abfd->where
+ || real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
+ abort ();
}
return (FILE *) abfd->iostream;