diff options
| author | Richard M. Stallman | 1994-05-17 09:46:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-17 09:46:59 +0000 |
| commit | 15fa1468c128719347b5e7f578fb930ce0e9af8f (patch) | |
| tree | c9de271518c51dbdb2745742dd9ded8eae789688 /src | |
| parent | cf2043478213c421f70701038035496a8d74f46f (diff) | |
| download | emacs-15fa1468c128719347b5e7f578fb930ce0e9af8f.tar.gz emacs-15fa1468c128719347b5e7f578fb930ce0e9af8f.zip | |
(Fdo_auto_save): Save listdesc as an integer, only if open.
(do_auto_save_unwind): Corresponding changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c index 4f1ff5bf69e..d4f832d64be 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3475,11 +3475,10 @@ auto_save_1 () | |||
| 3475 | } | 3475 | } |
| 3476 | 3476 | ||
| 3477 | static Lisp_Object | 3477 | static Lisp_Object |
| 3478 | do_auto_save_unwind (stream) /* used as unwind-protect function */ | 3478 | do_auto_save_unwind (desc) /* used as unwind-protect function */ |
| 3479 | Lisp_Object stream; | 3479 | Lisp_Object desc; |
| 3480 | { | 3480 | { |
| 3481 | close (*(int *)XPNTR (stream)); | 3481 | close (XINT (desc)); |
| 3482 | xfree (XPNTR (stream)); | ||
| 3483 | return Qnil; | 3482 | return Qnil; |
| 3484 | } | 3483 | } |
| 3485 | 3484 | ||
| @@ -3536,15 +3535,10 @@ Non-nil second argument means save only current buffer.") | |||
| 3536 | } | 3535 | } |
| 3537 | else | 3536 | else |
| 3538 | listdesc = -1; | 3537 | listdesc = -1; |
| 3539 | |||
| 3540 | /* We may not be able to store STREAM itself as a Lisp_Object pointer | ||
| 3541 | since that is guaranteed to work only for data that has been malloc'd. | ||
| 3542 | So malloc a full-size pointer, and record the address of that pointer. */ | ||
| 3543 | ptr = (int *) xmalloc (sizeof (int)); | ||
| 3544 | *ptr = listdesc; | ||
| 3545 | XSET (lispstream, Lisp_Internal_Stream, (int) ptr); | ||
| 3546 | 3538 | ||
| 3547 | record_unwind_protect (do_auto_save_unwind, lispstream); | 3539 | /* Arrange to close that file whether or not we get an error. */ |
| 3540 | if (listdesc >= 0) | ||
| 3541 | record_unwind_protect (do_auto_save_unwind, make_number (listdesc)); | ||
| 3548 | 3542 | ||
| 3549 | /* First, save all files which don't have handlers. If Emacs is | 3543 | /* First, save all files which don't have handlers. If Emacs is |
| 3550 | crashing, the handlers may tweak what is causing Emacs to crash | 3544 | crashing, the handlers may tweak what is causing Emacs to crash |