Fix more ungetc bugs with encoding errors
commitb8ead34f5df92b771520f4d090ff6cde49ca5705
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 8 Jul 2017 01:12:16 +0000 (7 18:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 8 Jul 2017 01:54:42 +0000 (7 18:54 -0700)
treedcd9a862148a1814ba6598f635b22d1e35ec82da
parent1628305811247bd652099dad92f6498fc244d8dc
Fix more ungetc bugs with encoding errors

* src/lread.c (infile): New variable, replacing ...
(instream): ... this.  All uses changed.
(readbyte_from_stdio): New function, which deals with lookahead.
(readbyte_from_file, Fget_file_char): Use it.
(Fget_file_char): When misused, signal an error instead of
relying on undefined behavior.
(close_infile_unwind): New function.
(Fload): Use it.
(readevalloop): 2nd arg is now struct infile *, not FILE *.
All callers changed.
(read1): Handle lookahead when copying doc strings with
encoding errors.
src/lread.c