if (EQ (readcharfun, Qget_file_char))
{
+ eassert (infile);
readbyte = readbyte_from_file;
goto read_multibyte;
}
string, and the cdr part is a value of readcharfun given to
read_vector. */
readbyte = readbyte_from_string;
+ eassert (infile);
if (EQ (XCDR (readcharfun), Qget_emacs_mule_file_char))
emacs_mule_encoding = 1;
goto read_multibyte;
if (EQ (readcharfun, Qget_emacs_mule_file_char))
{
readbyte = readbyte_from_file;
+ eassert (infile);
emacs_mule_encoding = 1;
goto read_multibyte;
}
static int
readbyte_from_file (int c, Lisp_Object readcharfun)
{
+ eassert (infile);
if (c >= 0)
{
eassert (infile->lookahead < sizeof infile->buf);
static void
close_infile_unwind (void *arg)
{
- FILE *stream = arg;
- eassert (infile == NULL || infile->stream == stream);
- infile = NULL;
- fclose (stream);
+ struct infile *prev_infile = arg;
+ fprintf (stderr, "Closing infile: back to %x!\n", prev_infile);
+ eassert (infile);
+ fclose (infile->stream);
+ infile = prev_infile;
}
DEFUN ("load", Fload, Sload, 1, 5, 0,
{
if (! stream)
report_file_error ("Opening stdio stream", file);
- set_unwind_protect_ptr (fd_index, close_infile_unwind, stream);
+ set_unwind_protect_ptr (fd_index, close_infile_unwind, infile);
}
if (! NILP (Vpurify_flag))
if (b && first_sexp)
whole_buffer = (BUF_PT (b) == BUF_BEG (b) && BUF_ZV (b) == BUF_Z (b));
- infile = infile0;
+ eassert (!infile0 || infile == infile0);
read_next:
c = READCHAR;
if (c == ';')