This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: line endings and specs parser
- To: Mumit Khan <khan at xraylith dot wisc dot EDU>
- Subject: Re: RFC: line endings and specs parser
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Sun, 08 Aug 1999 22:53:25 -0600
- cc: gcc at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <199908090254.VAA28193@mercury.xraylith.wisc.edu>you write:
> My second attempt worked much better, but at the expense of a bit of
> memory and some processing overhead. After reading the specs using
> read(), I allocate a 2nd buffer, copy the 1st onto 2nd using the
> following simple logic:
>
> for each character in input buffer,
> - if '\r', transform to '\n'.
> - if next character is '\n', advance input pointer (ie, just skip).
> - copy to output buffer
>
> This should handle EOL styles of \n, \r\n and \r.
>
> Comments? Is this worth it?
I would try to write this code in the cleanest possible manner. I can't
imagine that spec file reading is anywhere near the critical path for the
compiler.
jeff