summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2005-07-20 14:39:35 +0000
committerKim F. Storm <storm@cua.dk>2005-07-20 14:39:35 +0000
commitfff7e9825a1f99b9c0c35a399a7883db5bee6a58 (patch)
treece10066a57165b4e0921d3f9a8c4e88062c789a7 /src/fileio.c
parent0ed4bf159682bd56e2d87571afd4774ae41e966e (diff)
downloademacs-fff7e9825a1f99b9c0c35a399a7883db5bee6a58.tar.gz
(Fdo_auto_save, do_auto_save_unwind):
Use make_save_value to unwind protect stream.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 6070c28aed9..d09b4789639 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5818,13 +5818,13 @@ auto_save_1 ()
}
static Lisp_Object
-do_auto_save_unwind (stream) /* used as unwind-protect function */
- Lisp_Object stream;
+do_auto_save_unwind (arg) /* used as unwind-protect function */
+ Lisp_Object arg;
{
+ FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
auto_saving = 0;
- if (!NILP (stream))
- fclose ((FILE *) (XFASTINT (XCAR (stream)) << 16
- | XFASTINT (XCDR (stream))));
+ if (stream != NULL)
+ fclose (stream);
return Qnil;
}
@@ -5869,8 +5869,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
int auto_saved = 0;
int do_handled_files;
Lisp_Object oquit;
- FILE *stream;
- Lisp_Object lispstream;
+ FILE *stream = NULL;
int count = SPECPDL_INDEX ();
int orig_minibuffer_auto_raise = minibuffer_auto_raise;
int old_message_p = 0;
@@ -5922,24 +5921,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
}
stream = fopen (SDATA (listfile), "w");
- if (stream != NULL)
- {
- /* Arrange to close that file whether or not we get an error.
- Also reset auto_saving to 0. */
- lispstream = Fcons (Qnil, Qnil);
- XSETCARFASTINT (lispstream, (EMACS_UINT)stream >> 16);
- XSETCDRFASTINT (lispstream, (EMACS_UINT)stream & 0xffff);
- }
- else
- lispstream = Qnil;
- }
- else
- {
- stream = NULL;
- lispstream = Qnil;
}
- record_unwind_protect (do_auto_save_unwind, lispstream);
+ record_unwind_protect (do_auto_save_unwind,
+ make_save_value (stream, 0));
record_unwind_protect (do_auto_save_unwind_1,
make_number (minibuffer_auto_raise));
minibuffer_auto_raise = 0;