config: handle EOF properly
In the main loop we peek to see what kind of line the next one is. If there are multiple newlines before the end of the file, the eof marker won't be set after we read the last line with data and we'll try to peek again. This peek will return LF (as it pretends that we have a newline at EOF so other function don't need any special handling). Fix cfg_getchar so it doesn't try to read past the last character in the file and config_parse so it considers LF as EOF on peek (as we're ignoring spaces) and sets the reader's EOF flag to exit the parsing loop.
Showing
Please
register
or
sign in
to comment