close_infile_unwind (void *arg)
{
struct infile *prev_infile = arg;
- eassert (infile);
+ eassert (infile && infile != prev_infile);
fclose (infile->stream);
infile = prev_infile;
}
#endif
}
+ /* Declare here rather than inside the else-part because the storage
+ might be accessed by the unbind_to call below. */
+ struct infile input;
+
if (is_module)
{
/* `module-load' uses the file name, so we can close the stream
if (! stream)
report_file_error ("Opening stdio stream", file);
set_unwind_protect_ptr (fd_index, close_infile_unwind, infile);
+ input.stream = stream;
+ input.lookahead = 0;
+ infile = &input;
}
if (! NILP (Vpurify_flag))
specbind (Qinhibit_file_name_operation, Qnil);
specbind (Qload_in_progress, Qt);
- /* Declare here rather than inside the else-part because the storage
- might be accessed by the unbind_to call below. */
- struct infile input;
-
if (is_module)
{
#ifdef HAVE_MODULES
}
else
{
- input.stream = stream;
- input.lookahead = 0;
- infile = &input;
-
if (lisp_file_lexically_bound_p (Qget_file_char))
Fset (Qlexical_binding, Qt);