diff options
| author | Paul Eggert | 2012-12-05 10:29:52 -0800 |
|---|---|---|
| committer | Paul Eggert | 2012-12-05 10:29:52 -0800 |
| commit | 644d3f0dbf38eca7a746e0fb5a7a0dd20d214949 (patch) | |
| tree | 5a8626e0d9f34ef6cf54afea65de0446a339e5cb /src | |
| parent | ffcee8d7c43cef38612c39554212a5a20b75e05b (diff) | |
| download | emacs-644d3f0dbf38eca7a746e0fb5a7a0dd20d214949.tar.gz emacs-644d3f0dbf38eca7a746e0fb5a7a0dd20d214949.zip | |
Minor call-process cleanups.
* callproc.c (Fcall_process): Do record-unwind-protect on MSDOS
at the same time as other platforms, to simplify analysis.
No need for fd0_volatile since we have synch_process_fd.
Avoid needless emacs_close; arg is always negative.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/callproc.c | 26 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ef67df9d792..a6ba03a0069 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-12-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Minor call-process cleanups. | ||
| 4 | * callproc.c (Fcall_process): Do record-unwind-protect on MSDOS | ||
| 5 | at the same time as other platforms, to simplify analysis. | ||
| 6 | No need for fd0_volatile since we have synch_process_fd. | ||
| 7 | Avoid needless emacs_close; arg is always negative. | ||
| 8 | |||
| 1 | 2012-12-04 Andreas Schwab <schwab@linux-m68k.org> | 9 | 2012-12-04 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 10 | ||
| 3 | * callproc.c (Fcall_process): Fix specpdl nesting for asynchronous | 11 | * callproc.c (Fcall_process): Fix specpdl nesting for asynchronous |
diff --git a/src/callproc.c b/src/callproc.c index 2cc395428f8..2c3d31ba052 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -579,13 +579,20 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 579 | } | 579 | } |
| 580 | else | 580 | else |
| 581 | fd0 = -1; /* We are not going to read from tempfile. */ | 581 | fd0 = -1; /* We are not going to read from tempfile. */ |
| 582 | #else /* not MSDOS */ | 582 | #endif /* MSDOS */ |
| 583 | 583 | ||
| 584 | /* Do the unwind-protect now, even though the pid is not known, so | 584 | /* Do the unwind-protect now, even though the pid is not known, so |
| 585 | that no storage allocation is done in the critical section. | 585 | that no storage allocation is done in the critical section. |
| 586 | The actual PID will be filled in during the critical section. */ | 586 | The actual PID will be filled in during the critical section. */ |
| 587 | synch_process_pid = 0; | 587 | synch_process_pid = 0; |
| 588 | synch_process_fd = fd0; | 588 | synch_process_fd = fd0; |
| 589 | |||
| 590 | #ifdef MSDOS | ||
| 591 | /* MSDOS needs different cleanup information. */ | ||
| 592 | record_unwind_protect (call_process_cleanup, | ||
| 593 | Fcons (Fcurrent_buffer (), | ||
| 594 | build_string (tempfile ? tempfile : ""))); | ||
| 595 | #else | ||
| 589 | record_unwind_protect (call_process_cleanup, Fcurrent_buffer ()); | 596 | record_unwind_protect (call_process_cleanup, Fcurrent_buffer ()); |
| 590 | 597 | ||
| 591 | block_input (); | 598 | block_input (); |
| @@ -603,7 +610,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 603 | bool volatile display_p_volatile = display_p; | 610 | bool volatile display_p_volatile = display_p; |
| 604 | bool volatile output_to_buffer_volatile = output_to_buffer; | 611 | bool volatile output_to_buffer_volatile = output_to_buffer; |
| 605 | bool volatile sa_must_free_volatile = sa_must_free; | 612 | bool volatile sa_must_free_volatile = sa_must_free; |
| 606 | int volatile fd0_volatile = fd0; | ||
| 607 | int volatile fd1_volatile = fd1; | 613 | int volatile fd1_volatile = fd1; |
| 608 | int volatile fd_error_volatile = fd_error; | 614 | int volatile fd_error_volatile = fd_error; |
| 609 | int volatile fd_output_volatile = fd_output; | 615 | int volatile fd_output_volatile = fd_output; |
| @@ -621,7 +627,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 621 | display_p = display_p_volatile; | 627 | display_p = display_p_volatile; |
| 622 | output_to_buffer = output_to_buffer_volatile; | 628 | output_to_buffer = output_to_buffer_volatile; |
| 623 | sa_must_free = sa_must_free_volatile; | 629 | sa_must_free = sa_must_free_volatile; |
| 624 | fd0 = fd0_volatile; | ||
| 625 | fd1 = fd1_volatile; | 630 | fd1 = fd1_volatile; |
| 626 | fd_error = fd_error_volatile; | 631 | fd_error = fd_error_volatile; |
| 627 | fd_output = fd_output_volatile; | 632 | fd_output = fd_output_volatile; |
| @@ -629,6 +634,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 629 | count = count_volatile; | 634 | count = count_volatile; |
| 630 | sa_count = sa_count_volatile; | 635 | sa_count = sa_count_volatile; |
| 631 | new_argv = new_argv_volatile; | 636 | new_argv = new_argv_volatile; |
| 637 | |||
| 638 | fd0 = synch_process_fd; | ||
| 632 | } | 639 | } |
| 633 | 640 | ||
| 634 | if (pid == 0) | 641 | if (pid == 0) |
| @@ -682,18 +689,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 682 | } | 689 | } |
| 683 | 690 | ||
| 684 | if (INTEGERP (buffer)) | 691 | if (INTEGERP (buffer)) |
| 685 | { | 692 | return unbind_to (count, Qnil); |
| 686 | if (fd0 >= 0) | ||
| 687 | emacs_close (fd0); | ||
| 688 | return unbind_to (count, Qnil); | ||
| 689 | } | ||
| 690 | |||
| 691 | #if defined (MSDOS) | ||
| 692 | /* MSDOS needs different cleanup information. */ | ||
| 693 | record_unwind_protect (call_process_cleanup, | ||
| 694 | Fcons (Fcurrent_buffer (), | ||
| 695 | build_string (tempfile ? tempfile : ""))); | ||
| 696 | #endif | ||
| 697 | 693 | ||
| 698 | if (BUFFERP (buffer)) | 694 | if (BUFFERP (buffer)) |
| 699 | Fset_buffer (buffer); | 695 | Fset_buffer (buffer); |