This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, committed] make sure fixincl created files end with newline


Bruce Korb <bkorb@gnu.org> writes:

> 2005-11-24  Bruce Korb  <bkorb@gnu.org>
> 	* fixincl.c(write_replacement) "here strings" in AutoGen often/generally don't
> 	have a terminating newline.  This will check the last byte for '\n'.

Is this a fix for PR23400?  In that case it should go into the 4.1
branch as well,

Andreas

>
> Index: fixincl.c
> ===================================================================
> --- fixincl.c   (revision 107490)
> +++ fixincl.c   (working copy)
> @@ -1202,7 +1202,10 @@
>
>     {
>       FILE* out_fp = create_file ();
> -     fputs (pz_text, out_fp);
> +     size_t sz = strlen (pz_text);
> +     fwrite (pz_text, sz, 1, out_fp);
> +     if (pz_text[ sz-1 ] != '\n')
> +       fputc ('\n', out_fp);
>       fclose (out_fp);
>     }
>  }

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]