aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-04 02:04:33 -0700
committerPaul Eggert2011-04-04 02:04:33 -0700
commit82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d (patch)
tree0a4c9aba1b89be4402ae738ef3b1dafb11538bce /src/process.c
parentbc57d757a2a5ac2ccbd658c7905c653357fc9da3 (diff)
downloademacs-82eaa3332cd0568b8e8f3f3dc3438dab61b7cc1d.tar.gz
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.c38
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)
5162 } 5162 }
5163 else 5163 else
5164#endif 5164#endif
5165 if (proc_buffered_char[channel] < 0)
5166 { 5165 {
5166 int buffered = 0 <= proc_buffered_char[channel];
5167 if (buffered)
5168 {
5169 chars[carryover] = proc_buffered_char[channel];
5170 proc_buffered_char[channel] = -1;
5171 }
5167#ifdef HAVE_GNUTLS 5172#ifdef HAVE_GNUTLS
5168 if (XPROCESS (proc)->gnutls_p) 5173 if (XPROCESS (proc)->gnutls_p)
5169 nbytes = emacs_gnutls_read (channel, XPROCESS (proc), 5174 nbytes = emacs_gnutls_read (channel, XPROCESS (proc),
5170 chars + carryover, readmax); 5175 chars + carryover + buffered,
5176 readmax - buffered);
5171 else 5177 else
5172#endif 5178#endif
5173 nbytes = emacs_read (channel, chars + carryover, readmax); 5179 nbytes = emacs_read (channel, chars + carryover + buffered,
5180 readmax - buffered);
5174#ifdef ADAPTIVE_READ_BUFFERING 5181#ifdef ADAPTIVE_READ_BUFFERING
5175 if (nbytes > 0 && p->adaptive_read_buffering) 5182 if (nbytes > 0 && p->adaptive_read_buffering)
5176 { 5183 {
@@ -5184,7 +5191,7 @@ read_process_output (Lisp_Object proc, register int channel)
5184 delay += READ_OUTPUT_DELAY_INCREMENT * 2; 5191 delay += READ_OUTPUT_DELAY_INCREMENT * 2;
5185 } 5192 }
5186 } 5193 }
5187 else if (delay > 0 && (nbytes == readmax)) 5194 else if (delay > 0 && nbytes == readmax - buffered)
5188 { 5195 {
5189 delay -= READ_OUTPUT_DELAY_INCREMENT; 5196 delay -= READ_OUTPUT_DELAY_INCREMENT;
5190 if (delay == 0) 5197 if (delay == 0)
@@ -5198,22 +5205,13 @@ read_process_output (Lisp_Object proc, register int channel)
5198 } 5205 }
5199 } 5206 }
5200#endif 5207#endif
5201 } 5208 if (buffered)
5202 else 5209 {
5203 { 5210 if (nbytes < 0)
5204 chars[carryover] = proc_buffered_char[channel]; 5211 nbytes = 1;
5205 proc_buffered_char[channel] = -1; 5212 else
5206#ifdef HAVE_GNUTLS 5213 nbytes = nbytes + 1;
5207 if (XPROCESS (proc)->gnutls_p) 5214 }
5208 nbytes = emacs_gnutls_read (channel, XPROCESS (proc),
5209 chars + carryover + 1, readmax - 1);
5210 else
5211#endif
5212 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1);
5213 if (nbytes < 0)
5214 nbytes = 1;
5215 else
5216 nbytes = nbytes + 1;
5217 } 5215 }
5218 5216
5219 p->decoding_carryover = 0; 5217 p->decoding_carryover = 0;