aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2005-07-20 14:39:35 +0000
committerKim F. Storm2005-07-20 14:39:35 +0000
commitfff7e9825a1f99b9c0c35a399a7883db5bee6a58 (patch)
treece10066a57165b4e0921d3f9a8c4e88062c789a7 /src
parent0ed4bf159682bd56e2d87571afd4774ae41e966e (diff)
downloademacs-fff7e9825a1f99b9c0c35a399a7883db5bee6a58.tar.gz
emacs-fff7e9825a1f99b9c0c35a399a7883db5bee6a58.zip
(Fdo_auto_save, do_auto_save_unwind):
Use make_save_value to unwind protect stream.
Diffstat (limited to 'src')
-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 ()
5818} 5818}
5819 5819
5820static Lisp_Object 5820static Lisp_Object
5821do_auto_save_unwind (stream) /* used as unwind-protect function */ 5821do_auto_save_unwind (arg) /* used as unwind-protect function */
5822 Lisp_Object stream; 5822 Lisp_Object arg;
5823{ 5823{
5824 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
5824 auto_saving = 0; 5825 auto_saving = 0;
5825 if (!NILP (stream)) 5826 if (stream != NULL)
5826 fclose ((FILE *) (XFASTINT (XCAR (stream)) << 16 5827 fclose (stream);
5827 | XFASTINT (XCDR (stream))));
5828 return Qnil; 5828 return Qnil;
5829} 5829}
5830 5830
@@ -5869,8 +5869,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5869 int auto_saved = 0; 5869 int auto_saved = 0;
5870 int do_handled_files; 5870 int do_handled_files;
5871 Lisp_Object oquit; 5871 Lisp_Object oquit;
5872 FILE *stream; 5872 FILE *stream = NULL;
5873 Lisp_Object lispstream;
5874 int count = SPECPDL_INDEX (); 5873 int count = SPECPDL_INDEX ();
5875 int orig_minibuffer_auto_raise = minibuffer_auto_raise; 5874 int orig_minibuffer_auto_raise = minibuffer_auto_raise;
5876 int old_message_p = 0; 5875 int old_message_p = 0;
@@ -5922,24 +5921,10 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5922 } 5921 }
5923 5922
5924 stream = fopen (SDATA (listfile), "w"); 5923 stream = fopen (SDATA (listfile), "w");
5925 if (stream != NULL)
5926 {
5927 /* Arrange to close that file whether or not we get an error.
5928 Also reset auto_saving to 0. */
5929 lispstream = Fcons (Qnil, Qnil);
5930 XSETCARFASTINT (lispstream, (EMACS_UINT)stream >> 16);
5931 XSETCDRFASTINT (lispstream, (EMACS_UINT)stream & 0xffff);
5932 }
5933 else
5934 lispstream = Qnil;
5935 }
5936 else
5937 {
5938 stream = NULL;
5939 lispstream = Qnil;
5940 } 5924 }
5941 5925
5942 record_unwind_protect (do_auto_save_unwind, lispstream); 5926 record_unwind_protect (do_auto_save_unwind,
5927 make_save_value (stream, 0));
5943 record_unwind_protect (do_auto_save_unwind_1, 5928 record_unwind_protect (do_auto_save_unwind_1,
5944 make_number (minibuffer_auto_raise)); 5929 make_number (minibuffer_auto_raise));
5945 minibuffer_auto_raise = 0; 5930 minibuffer_auto_raise = 0;