aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-01-24 19:38:04 +0000
committerNick Clifton <nickc@redhat.com>2000-01-24 19:38:04 +0000
commitb5f303f092e873d88d2b9459deb105e20ff5222c (patch)
treec499749492017f23633eebdbfca12793560c6664 /bfd/coffcode.h
parente1c47aa42d359b3b54ecf3b9eb7eed8b81852302 (diff)
downloadgdb-b5f303f092e873d88d2b9459deb105e20ff5222c.zip
gdb-b5f303f092e873d88d2b9459deb105e20ff5222c.tar.gz
gdb-b5f303f092e873d88d2b9459deb105e20ff5222c.tar.bz2
Remove use of a GCC extension when allocating local arrays.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 222089f..ace39e1 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -3680,20 +3680,41 @@ coff_write_object_contents (abfd)
/* now write them */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
+
{
- char buff[bfd_coff_filhsz (abfd)];
+ char * buff;
+ bfd_size_type amount;
+
+ buff = bfd_malloc (bfd_coff_filhsz (abfd));
+ if (buff == NULL)
+ return false;
+
coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
- if (bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd)
- != bfd_coff_filhsz (abfd))
+ amount = bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd);
+
+ free (buff);
+
+ if (amount != bfd_coff_filhsz (abfd))
return false;
}
+
if (abfd->flags & EXEC_P)
{
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */
- char buff[bfd_coff_aoutsz (abfd)];
+ char * buff;
+ bfd_size_type amount;
+
+ buff = bfd_malloc (bfd_coff_aoutsz (abfd));
+ if (buff == NULL)
+ return false;
+
coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
- if (bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd) != bfd_coff_aoutsz (abfd))
+ amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd);
+
+ free (buff);
+
+ if (amount != bfd_coff_aoutsz (abfd))
return false;
}
#ifdef RS6000COFF_C