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/coff-sh.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/coff-sh.c')
-rw-r--r-- | bfd/coff-sh.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index a57a353..5d987b6 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -482,12 +482,9 @@ sh_relax_section (abfd, sec, link_info, again) contents = coff_section_data (abfd, sec)->contents; else { - contents = (bfd_byte *) malloc (sec->_raw_size); + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); if (contents == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; free_contents = contents; if (! bfd_get_section_contents (abfd, sec, contents, @@ -1087,12 +1084,9 @@ sh_relax_delete_bytes (abfd, sec, addr, count) Perhaps, if info->keep_memory is false, we should free them, if we are permitted to, when we leave sh_coff_relax_section. */ - ocontents = (bfd_byte *) malloc (o->_raw_size); + ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); if (ocontents == NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; if (! bfd_get_section_contents (abfd, o, ocontents, (file_ptr) 0, o->_raw_size)) @@ -1383,21 +1377,15 @@ sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, goto error_return; internal_syms = ((struct internal_syment *) - malloc (obj_raw_syment_count (input_bfd) - * sizeof (struct internal_syment))); + bfd_malloc (obj_raw_syment_count (input_bfd) + * sizeof (struct internal_syment))); if (internal_syms == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; - sections = (asection **) malloc (obj_raw_syment_count (input_bfd) - * sizeof (asection *)); + sections = (asection **) bfd_malloc (obj_raw_syment_count (input_bfd) + * sizeof (asection *)); if (sections == NULL) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; isymp = internal_syms; secpp = sections; |