aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorMiles Bader2005-06-06 02:39:45 +0000
committerMiles Bader2005-06-06 02:39:45 +0000
commitfdffd346262841cb194225ea0acd8059c57ec2d4 (patch)
treed8b3699131f7d1b94bc46c7d8be62af6b8b5ebfe /src/callproc.c
parenta5c508fe3a3f456c987283156315d0384d38fe9e (diff)
parenta9b4333620eb259e974445066a8e64cee0c21d69 (diff)
downloademacs-fdffd346262841cb194225ea0acd8059c57ec2d4.tar.gz
emacs-fdffd346262841cb194225ea0acd8059c57ec2d4.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-57
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 324-352) - Merge from gnus--rel--5.10 - Update from CVS - etc/emacs-buffer.gdb: Remove RCS keywords * gnus--rel--5.10 (patch 70-79) - Update from CVS - Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/callproc.c b/src/callproc.c
index c410b5a121b..524f6a6a078 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -218,9 +218,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
218 int fd[2]; 218 int fd[2];
219 int filefd; 219 int filefd;
220 register int pid; 220 register int pid;
221 char buf[16384]; 221#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
222 char *bufptr = buf; 222#define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN)
223 int bufsize = sizeof buf; 223 char buf[CALLPROC_BUFFER_SIZE_MAX];
224 int bufsize = CALLPROC_BUFFER_SIZE_MIN;
224 int count = SPECPDL_INDEX (); 225 int count = SPECPDL_INDEX ();
225 226
226 register const unsigned char **new_argv 227 register const unsigned char **new_argv
@@ -753,7 +754,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
753 nread = carryover; 754 nread = carryover;
754 while (nread < bufsize - 1024) 755 while (nread < bufsize - 1024)
755 { 756 {
756 int this_read = emacs_read (fd[0], bufptr + nread, 757 int this_read = emacs_read (fd[0], buf + nread,
757 bufsize - nread); 758 bufsize - nread);
758 759
759 if (this_read < 0) 760 if (this_read < 0)
@@ -779,7 +780,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
779 { 780 {
780 if (NILP (current_buffer->enable_multibyte_characters) 781 if (NILP (current_buffer->enable_multibyte_characters)
781 && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) 782 && ! CODING_MAY_REQUIRE_DECODING (&process_coding))
782 insert_1_both (bufptr, nread, nread, 0, 1, 0); 783 insert_1_both (buf, nread, nread, 0, 1, 0);
783 else 784 else
784 { /* We have to decode the input. */ 785 { /* We have to decode the input. */
785 Lisp_Object buf; 786 Lisp_Object buf;
@@ -826,17 +827,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
826 if (process_coding.mode & CODING_MODE_LAST_BLOCK) 827 if (process_coding.mode & CODING_MODE_LAST_BLOCK)
827 break; 828 break;
828 829
830#if (CALLPROC_BUFFER_SIZE_MIN != CALLPROC_BUFFER_SIZE_MAX)
829 /* Make the buffer bigger as we continue to read more data, 831 /* Make the buffer bigger as we continue to read more data,
830 but not past 64k. */ 832 but not past CALLPROC_BUFFER_SIZE_MAX. */
831 if (bufsize < 64 * 1024 && total_read > 32 * bufsize) 833 if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize)
832 { 834 if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX)
833 char *tempptr; 835 bufsize = CALLPROC_BUFFER_SIZE_MAX;
834 bufsize *= 2; 836#endif
835
836 tempptr = (char *) alloca (bufsize);
837 bcopy (bufptr, tempptr, bufsize / 2);
838 bufptr = tempptr;
839 }
840 837
841 if (display_p) 838 if (display_p)
842 { 839 {