diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-12-01 19:48:10 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-12-01 19:48:10 +0000 |
commit | 58142f101dd3256f4741f60a6b25672d79b91371 (patch) | |
tree | e7ca6dd97a327093be2076160bebd1baaf20d8a4 /bfd/sunos.c | |
parent | 2eec871057c921ceb38fb0b7f3cd78e84b700808 (diff) | |
download | binutils-gdb-58142f101dd3256f4741f60a6b25672d79b91371.tar.gz |
* libbfd.c (bfd_malloc, bfd_realloc): New functions.
(bfd_zmalloc): Return PTR, not char *. Take size_t, not
bfd_size_type.
* libbfd-in.h (bfd_malloc, bfd_realloc): Declare.
(bfd_zmalloc): Change declaration.
* libbfd.h: Rebuild.
* Many files: Use bfd_malloc and bfd_realloc rather than malloc
and realloc. Don't set bfd_error_no_memory if they fail.
Diffstat (limited to 'bfd/sunos.c')
-rw-r--r-- | bfd/sunos.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/bfd/sunos.c b/bfd/sunos.c index ffd4fdc0f5a..25b9072c306 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -350,7 +350,7 @@ sunos_canonicalize_dynamic_symtab (abfd, storage) if (info->dyninfo.ld_buckets > info->dynsym_count) abort (); table_size = info->dyninfo.ld_stab - info->dyninfo.ld_hash; - table = (bfd_byte *) malloc (table_size); + table = (bfd_byte *) bfd_malloc (table_size); if (table == NULL && table_size != 0) abort (); if (bfd_seek (abfd, info->dyninfo.ld_hash, SEEK_SET) != 0 @@ -1311,13 +1311,10 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr, bfd_byte *contents; add = 8 - (s->_raw_size & 7); - contents = (bfd_byte *) realloc (s->contents, - (size_t) (s->_raw_size + add)); + contents = (bfd_byte *) bfd_realloc (s->contents, + (size_t) (s->_raw_size + add)); if (contents == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; memset (contents + s->_raw_size, 0, (size_t) add); s->contents = contents; s->_raw_size += add; @@ -1389,7 +1386,7 @@ sunos_scan_relocs (info, abfd, sec, rel_size) return true; if (! info->keep_memory) - relocs = free_relocs = malloc ((size_t) rel_size); + relocs = free_relocs = bfd_malloc ((size_t) rel_size); else { struct aout_section_data_struct *n; @@ -1401,15 +1398,12 @@ sunos_scan_relocs (info, abfd, sec, rel_size) else { set_aout_section_data (sec, n); - relocs = malloc ((size_t) rel_size); + relocs = bfd_malloc ((size_t) rel_size); aout_section_data (sec)->relocs = relocs; } } if (relocs == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 || bfd_read (relocs, 1, rel_size, abfd) != rel_size) @@ -1942,16 +1936,10 @@ sunos_scan_dynamic_symbol (h, data) There are no debugging symbols in the dynamic symbols. */ s = bfd_get_section_by_name (dynobj, ".dynstr"); BFD_ASSERT (s != NULL); - if (s->contents == NULL) - contents = (bfd_byte *) malloc (len + 1); - else - contents = (bfd_byte *) realloc (s->contents, - (size_t) (s->_raw_size + len + 1)); + contents = (bfd_byte *) bfd_realloc (s->contents, + s->_raw_size + len + 1); if (contents == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; s->contents = contents; h->dynstr_index = s->_raw_size; |