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/bout.c | |
parent | 2eec871057c921ceb38fb0b7f3cd78e84b700808 (diff) | |
download | gdb-58142f101dd3256f4741f60a6b25672d79b91371.zip gdb-58142f101dd3256f4741f60a6b25672d79b91371.tar.gz gdb-58142f101dd3256f4741f60a6b25672d79b91371.tar.bz2 |
* 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/bout.c')
-rw-r--r-- | bfd/bout.c | 29 |
1 files changed, 9 insertions, 20 deletions
@@ -500,16 +500,13 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return false; count = reloc_size / sizeof (struct relocation_info); - relocs = (struct relocation_info *) malloc (reloc_size); - if (!relocs && reloc_size != 0) { - bfd_set_error (bfd_error_no_memory); + relocs = (struct relocation_info *) bfd_malloc (reloc_size); + if (!relocs && reloc_size != 0) return false; - } - reloc_cache = (arelent *) malloc ((count+1) * sizeof (arelent)); + reloc_cache = (arelent *) bfd_malloc ((count+1) * sizeof (arelent)); if (!reloc_cache) { if (relocs != NULL) free ((char*)relocs); - bfd_set_error (bfd_error_no_memory); return false; } @@ -698,11 +695,9 @@ b_out_squirt_out_relocs (abfd, section) int extern_mask, pcrel_mask, len_2, callj_mask; if (count == 0) return true; generic = section->orelocation; - native = ((struct relocation_info *) malloc (natsize)); - if (!native && natsize != 0) { - bfd_set_error (bfd_error_no_memory); + native = ((struct relocation_info *) bfd_malloc (natsize)); + if (!native && natsize != 0) return false; - } if (abfd->xvec->header_byteorder_big_p) { @@ -1154,12 +1149,9 @@ b_out_bfd_relax_section (abfd, i, link_info, again) { long reloc_count; - reloc_vector = (arelent **) malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; /* Get the relocs and think about them */ reloc_count = @@ -1230,12 +1222,9 @@ b_out_bfd_get_relocated_section_contents (in_abfd, link_info, link_order, data, relocateable, symbols); - reloc_vector = (arelent **) malloc (reloc_size); + reloc_vector = (arelent **) bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; input_section->reloc_done = 1; |