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/coffgen.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/coffgen.c')
-rw-r--r-- | bfd/coffgen.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 14c0e38..7ad5b6f 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -397,12 +397,9 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, if (external_relocs == NULL) { - free_external = (bfd_byte *) malloc (sec->reloc_count * relsz); + free_external = (bfd_byte *) bfd_malloc (sec->reloc_count * relsz); if (free_external == NULL && sec->reloc_count > 0) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; external_relocs = free_external; } @@ -414,13 +411,10 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, if (internal_relocs == NULL) { free_internal = ((struct internal_reloc *) - malloc (sec->reloc_count - * sizeof (struct internal_reloc))); + bfd_malloc (sec->reloc_count + * sizeof (struct internal_reloc))); if (free_internal == NULL && sec->reloc_count > 0) - { - bfd_set_error (bfd_error_no_memory); - goto error_return; - } + goto error_return; internal_relocs = free_internal; } @@ -1456,12 +1450,9 @@ _bfd_coff_get_external_symbols (abfd) size = obj_raw_syment_count (abfd) * symesz; - syms = (PTR) malloc (size); + syms = (PTR) bfd_malloc (size); if (syms == NULL && size != 0) - { - bfd_set_error (bfd_error_no_memory); - return false; - } + return false; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 || bfd_read (syms, size, 1, abfd) != size) @@ -1523,12 +1514,9 @@ _bfd_coff_read_string_table (abfd) return NULL; } - strings = (char *) malloc (strsize); + strings = (char *) bfd_malloc (strsize); if (strings == NULL) - { - bfd_set_error (bfd_error_no_memory); - return NULL; - } + return NULL; if (bfd_read (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, 1, abfd) |