• Paul Eggert's avatar
    Fix more ungetc bugs with encoding errors · b8ead34f
    Paul Eggert authored
    * 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.
lread.c 150 KB