{ bfd_set_error (bfd_error_no_memory); return NULL; }
return NULL;
oasys_archive_p (abfd)     bfd *abfd;{  oasys_archive_header_type header;  oasys_extarchive_header_type header_ext;  unsigned int i;  file_ptr filepos;  if (bfd_seek (abfd, (file_ptr) 0, false) != 0      || (bfd_read ((PTR) & header_ext, 1, sizeof (header_ext), abfd)	  != sizeof (header_ext)))    {      if (bfd_get_error () != bfd_error_system_call)	bfd_set_error (bfd_error_wrong_format);      return NULL;    }  header.version = bfd_h_get_32 (abfd, header_ext.version);  header.mod_count = bfd_h_get_32 (abfd, header_ext.mod_count);  header.mod_tbl_offset = bfd_h_get_32 (abfd, header_ext.mod_tbl_offset);  header.sym_tbl_size = bfd_h_get_32 (abfd, header_ext.sym_tbl_size);  header.sym_count = bfd_h_get_32 (abfd, header_ext.sym_count);  header.sym_tbl_offset = bfd_h_get_32 (abfd, header_ext.sym_tbl_offset);  header.xref_count = bfd_h_get_32 (abfd, header_ext.xref_count);  header.xref_lst_offset = bfd_h_get_32 (abfd, header_ext.xref_lst_offset);  /*    There isn't a magic number in an Oasys archive, so the best we    can do to verify reasnableness is to make sure that the values in    the header are too weird    */  if (header.version > 10000 ||      header.mod_count > 10000 ||      header.sym_count > 100000 ||      header.xref_count > 100000)    return (const bfd_target *) NULL;  /*    That all worked, let's buy the space for the header and read in    the headers.    */  {    oasys_ar_data_type *ar =    (oasys_ar_data_type *) bfd_alloc (abfd, sizeof (oasys_ar_data_type));    oasys_module_info_type *module =    (oasys_module_info_type *)    bfd_alloc (abfd, sizeof (oasys_module_info_type) * header.mod_count);    oasys_module_table_type record;    if (!ar || !module)      {	bfd_set_error (bfd_error_no_memory);	return NULL;      }    abfd->tdata.oasys_ar_data = ar;    ar->module = module;    ar->module_count = header.mod_count;    filepos = header.mod_tbl_offset;    for (i = 0; i < header.mod_count; i++)      {	if (bfd_seek (abfd, filepos, SEEK_SET) != 0)	  return NULL;	/* There are two ways of specifying the archive header */	if (0)	  {	    oasys_extmodule_table_type_a_type record_ext;	    if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)		!= sizeof (record_ext))	      return NULL;	    record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);	    record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);	    record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count);	    record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count);	    record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count);	    module[i].name = bfd_alloc (abfd, 33);	    if (!module[i].name)	      {		bfd_set_error (bfd_error_no_memory);		return NULL;	      }	    memcpy (module[i].name, record_ext.mod_name, 33);	    filepos +=	      sizeof (record_ext) +	      record.dep_count * 4 +	      record.depee_count * 4 +	      record.sect_count * 8 + 187;	  }	else	  {	    oasys_extmodule_table_type_b_type record_ext;	    if (bfd_read ((PTR) & record_ext, 1, sizeof (record_ext), abfd)		!= sizeof (record_ext))	      return NULL;	    record.mod_size = bfd_h_get_32 (abfd, record_ext.mod_size);	    record.file_offset = bfd_h_get_32 (abfd, record_ext.file_offset);	    record.dep_count = bfd_h_get_32 (abfd, record_ext.dep_count);	    record.depee_count = bfd_h_get_32 (abfd, record_ext.depee_count);	    record.sect_count = bfd_h_get_32 (abfd, record_ext.sect_count);	    record.module_name_size = bfd_h_get_32 (abfd, record_ext.mod_name_length);	    module[i].name = bfd_alloc (abfd, record.module_name_size + 1);	    if (!module[i].name)	      {		bfd_set_error (bfd_error_no_memory);		return NULL;	      }	    if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,			  abfd)		!= record.module_name_size)	      return NULL;	    module[i].name[record.module_name_size] = 0;	    filepos +=	      sizeof (record_ext) +	      record.dep_count * 4 +	      record.module_name_size + 1;	  }	module[i].size = record.mod_size;	module[i].pos = record.file_offset;	module[i].abfd = 0;      }  }  return abfd->xvec;}