if strchr(bp, '\n') didn't find anything the first time, it won't find anything the second time, either.
Change to'\0' to find the end-of-line. It's still a syntax error (the grammar requires a '\n') but it won't cause an alloc error.
This is only an issue if there's no end-of-line while lexing a rule's cost code (so not a problem with any of lcc's files).
if
strchr(bp, '\n')
didn't find anything the first time, it won't find anything the second time, either. Change to'\0'
to find the end-of-line. It's still a syntax error (the grammar requires a'\n'
) but it won't cause an alloc error.This is only an issue if there's no end-of-line while lexing a rule's cost code (so not a problem with any of lcc's files).