lean4
lean4 copied to clipboard
fix: include NUL characters on calls to getLine
Fixes #3546 ("null characters break readFile
/getLine
").
This draft pull request showcases an implementation of getLine
that would not truncate on the first occurrence of the NUL character (\0
) and properly seek the newline character (assuming text mode) in case users expect getLine
to preserve NUL characters in text input.
However, I was concerned that some parts of the Lean runtime might expect NUL-terminated strings. I am new to the codebase, so I'm not sure.
The repeated calls to ungetc
may negatively affect performance. I'm not sure about this approach, either. I'm open to discussions.