DEFAULT_BUFFERSIZE

There isn't any reason to think that a particular buffer size is
ideal in bfd, so let's just not define it.

	* libbfd-in.h (DEFAULT_BUFFERSIZE): Don't define.
	* libbfd.h: Regenerate.
	* archive.c (AR_WRITE_BUFFERSIZE): Substitute value.
	* vms-lib.c (_bfd_vms_lib_write_archive_contents): Likewise.
	* coff-rs6000.c (do_copy): Likewise, and use sizeof.
This commit is contained in:
Alan Modra
2023-08-30 22:42:53 +09:30
parent 50e193c186
commit d7d4e91155
5 changed files with 7 additions and 15 deletions

View File

@@ -2019,20 +2019,20 @@ static bool
do_copy (bfd *out_bfd, bfd *in_bfd)
{
bfd_size_type remaining;
bfd_byte buffer[DEFAULT_BUFFERSIZE];
bfd_byte buffer[8 * 1024];
if (bfd_seek (in_bfd, 0, SEEK_SET) != 0)
return false;
remaining = arelt_size (in_bfd);
while (remaining >= DEFAULT_BUFFERSIZE)
while (remaining >= sizeof (buffer))
{
if (bfd_read (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
|| bfd_write (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
if (bfd_read (buffer, sizeof (buffer), in_bfd) != sizeof (buffer)
|| bfd_write (buffer, sizeof (buffer), out_bfd) != sizeof (buffer))
return false;
remaining -= DEFAULT_BUFFERSIZE;
remaining -= sizeof (buffer);
}
if (remaining)