RFC: line endings and specs parser
Jeffrey A Law
law@cygnus.com
Tue Aug 31 23:20:00 GMT 1999
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
More information about the Gcc
mailing list