fix-header.c (main): Move inf_buffer termination and inf_limit calculation to after read.

* fix-header.c (main): Move inf_buffer termination and inf_limit
	calculation to after read.

From-SVN: r47307
This commit is contained in:
Douglas B Rupp 2001-11-24 17:17:58 -05:00 committed by Richard Kenner
parent 1dfc53859f
commit e1c12209fd
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,8 @@
Sat Nov 24 17:04:10 2001 Douglas B. Rupp <rupp@gnat.com>
* fix-header.c (main): Move inf_buffer termination and inf_limit
calculation to after read.
* config/alpha/xm-vms.h (FILE_TYPE): Remove undef and baggage.
(__UNIX_FOPEN): Define.

View File

@ -1184,9 +1184,6 @@ main (argc, argv)
}
inf_size = sbuf.st_size;
inf_buffer = (char *) xmalloc (inf_size + 2);
inf_buffer[inf_size] = '\n';
inf_buffer[inf_size + 1] = '\0';
inf_limit = inf_buffer + inf_size;
inf_ptr = inf_buffer;
to_read = inf_size;
@ -1209,6 +1206,11 @@ main (argc, argv)
close (inf_fd);
/* Inf_size may have changed if read was short (as on VMS) */
inf_buffer[inf_size] = '\n';
inf_buffer[inf_size + 1] = '\0';
inf_limit = inf_buffer + inf_size;
/* If file doesn't end with '\n', add one. */
if (inf_limit > inf_buffer && inf_limit[-1] != '\n')
inf_limit++;