(Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage,
Lisp_Object nosuffix, Lisp_Object must_suffix)
{
- FILE *stream;
+ FILE *stream = NULL;
int fd;
- int fd_index;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3;
Lisp_Object found, efound, hist_file_name;
#endif
}
- if (fd < 0)
+ if (fd >= 0)
{
- /* Pacify older GCC with --enable-gcc-warnings. */
- IF_LINT (fd_index = 0);
- }
- else
- {
- fd_index = SPECPDL_INDEX ();
- record_unwind_protect_int (close_file_unwind, fd);
+ record_unwind_protect_ptr (close_file_ptr_unwind, &fd);
+ record_unwind_protect_ptr (fclose_ptr_unwind, &stream);
}
/* Check if we're stuck in a recursive load cycle.
if (fd >= 0)
{
emacs_close (fd);
- clear_unwind_protect (fd_index);
+ fd = -1;
}
val = call4 (Vload_source_file_function, found, hist_file_name,
NILP (noerror) ? Qnil : Qt,
{
#ifdef WINDOWSNT
emacs_close (fd);
- clear_unwind_protect (fd_index);
+ fd = -1;
efound = ENCODE_FILE (found);
stream = emacs_fopen (SSDATA (efound), fmode);
#else
}
if (! stream)
report_file_error ("Opening stdio stream", file);
- set_unwind_protect_ptr (fd_index, fclose_unwind, stream);
if (! NILP (Vpurify_flag))
Vpreloaded_file_list = Fcons (Fpurecopy (file), Vpreloaded_file_list);