diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-04 02:04:33 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-04 02:04:33 -0700 |
commit | 82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d (patch) | |
tree | 0a4c9aba1b89be4402ae738ef3b1dafb11538bce /src/process.c | |
parent | bc57d757a2a5ac2ccbd658c7905c653357fc9da3 (diff) | |
download | emacs-82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d.tar.gz emacs-82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d.tar.bz2 emacs-82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d.zip |
* process.c (read_process_output): Do adaptive read buffering even if carryover.
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/process.c b/src/process.c index 50a068b2339..33f41c4a8f0 100644 --- a/src/process.c +++ b/src/process.c @@ -5162,15 +5162,22 @@ read_process_output (Lisp_Object proc, register int channel) } else #endif - if (proc_buffered_char[channel] < 0) { + int buffered = 0 <= proc_buffered_char[channel]; + if (buffered) + { + chars[carryover] = proc_buffered_char[channel]; + proc_buffered_char[channel] = -1; + } #ifdef HAVE_GNUTLS if (XPROCESS (proc)->gnutls_p) nbytes = emacs_gnutls_read (channel, XPROCESS (proc), - chars + carryover, readmax); + chars + carryover + buffered, + readmax - buffered); else #endif - nbytes = emacs_read (channel, chars + carryover, readmax); + nbytes = emacs_read (channel, chars + carryover + buffered, + readmax - buffered); #ifdef ADAPTIVE_READ_BUFFERING if (nbytes > 0 && p->adaptive_read_buffering) { @@ -5184,7 +5191,7 @@ read_process_output (Lisp_Object proc, register int channel) delay += READ_OUTPUT_DELAY_INCREMENT * 2; } } - else if (delay > 0 && (nbytes == readmax)) + else if (delay > 0 && nbytes == readmax - buffered) { delay -= READ_OUTPUT_DELAY_INCREMENT; if (delay == 0) @@ -5198,22 +5205,13 @@ read_process_output (Lisp_Object proc, register int channel) } } #endif - } - else - { - chars[carryover] = proc_buffered_char[channel]; - proc_buffered_char[channel] = -1; -#ifdef HAVE_GNUTLS - if (XPROCESS (proc)->gnutls_p) - nbytes = emacs_gnutls_read (channel, XPROCESS (proc), - chars + carryover + 1, readmax - 1); - else -#endif - nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); - if (nbytes < 0) - nbytes = 1; - else - nbytes = nbytes + 1; + if (buffered) + { + if (nbytes < 0) + nbytes = 1; + else + nbytes = nbytes + 1; + } } p->decoding_carryover = 0; |