diff options
| author | Kenichi Handa | 1997-12-09 04:12:03 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-12-09 04:12:03 +0000 |
| commit | 486b111b207abc002c60ffe53b51eb28b7f5c66e (patch) | |
| tree | 83cc189259b90815b6e859d1b8835ef5bb10f42a /src/process.c | |
| parent | b56567b5fd40f178124fee6a69adf43eda89002b (diff) | |
| download | emacs-486b111b207abc002c60ffe53b51eb28b7f5c66e.tar.gz emacs-486b111b207abc002c60ffe53b51eb28b7f5c66e.zip | |
(read_process_output): Fix previous change, i.e, if
proc_encode_coding_system[p->outfd] is NULL, instead of allocating
`struct coding_system' for encoding, just skip setting up coding
system for encoding. Set Vlast_coding_system_used after some text
is read.
(send_process): Set Vlast_coding_system_used after deciding a
coding system to be used for encoding.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c index d05071824de..ef0cd07d883 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2807,15 +2807,17 @@ read_process_output (proc, channel) | |||
| 2807 | proc_decode_coding_system[channel] here. It is done in | 2807 | proc_decode_coding_system[channel] here. It is done in |
| 2808 | detect_coding called via decode_coding above. */ | 2808 | detect_coding called via decode_coding above. */ |
| 2809 | 2809 | ||
| 2810 | /* If coding-system for encoding is not yet decided, we set it | 2810 | /* If coding-system for encoding is not yet decided, we set |
| 2811 | as the same as coding-system for decoding. */ | 2811 | it as the same as coding-system for decoding. |
| 2812 | if (NILP (p->encode_coding_system)) | 2812 | |
| 2813 | But, before doing that we must check if | ||
| 2814 | proc_encode_coding_system[p->outfd] surely points to a | ||
| 2815 | valid memory because p->outfd will be changed once EOF is | ||
| 2816 | sent to the process. */ | ||
| 2817 | if (NILP (p->encode_coding_system) | ||
| 2818 | && proc_encode_coding_system[p->outfd]) | ||
| 2813 | { | 2819 | { |
| 2814 | p->encode_coding_system = coding->symbol; | 2820 | p->encode_coding_system = coding->symbol; |
| 2815 | if (!proc_encode_coding_system[p->outfd]) | ||
| 2816 | proc_encode_coding_system[p->outfd] | ||
| 2817 | = ((struct coding_system *) | ||
| 2818 | xmalloc (sizeof (struct coding_system))); | ||
| 2819 | setup_coding_system (coding->symbol, | 2821 | setup_coding_system (coding->symbol, |
| 2820 | proc_encode_coding_system[p->outfd]); | 2822 | proc_encode_coding_system[p->outfd]); |
| 2821 | } | 2823 | } |
| @@ -2846,6 +2848,8 @@ read_process_output (proc, channel) | |||
| 2846 | } | 2848 | } |
| 2847 | #endif | 2849 | #endif |
| 2848 | 2850 | ||
| 2851 | Vlast_coding_system_used = coding->symbol; | ||
| 2852 | |||
| 2849 | outstream = p->filter; | 2853 | outstream = p->filter; |
| 2850 | if (!NILP (outstream)) | 2854 | if (!NILP (outstream)) |
| 2851 | { | 2855 | { |
| @@ -3047,6 +3051,8 @@ send_process (proc, buf, len, object) | |||
| 3047 | error ("Output file descriptor of %s is closed", procname); | 3051 | error ("Output file descriptor of %s is closed", procname); |
| 3048 | 3052 | ||
| 3049 | coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; | 3053 | coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; |
| 3054 | Vlast_coding_system_used = coding->symbol; | ||
| 3055 | |||
| 3050 | if (CODING_REQUIRE_ENCODING (coding)) | 3056 | if (CODING_REQUIRE_ENCODING (coding)) |
| 3051 | { | 3057 | { |
| 3052 | int require = encoding_buffer_size (coding, len); | 3058 | int require = encoding_buffer_size (coding, len); |