Mercurial > emacs
comparison src/callproc.c @ 90188:01137c1fdbe9
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
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 06 Jun 2005 02:39:45 +0000 |
parents | 4da4a09e8b1b d7793ac6df62 |
children | d8a6a0474c49 |
comparison
equal
deleted
inserted
replaced
90187:587ea1490d70 | 90188:01137c1fdbe9 |
---|---|
216 Lisp_Object infile, buffer, current_dir, path; | 216 Lisp_Object infile, buffer, current_dir, path; |
217 int display_p; | 217 int display_p; |
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 |
227 = (const unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *)); | 228 = (const unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *)); |
228 struct buffer *old = current_buffer; | 229 struct buffer *old = current_buffer; |
751 of the buffer size we have. But don't read | 752 of the buffer size we have. But don't read |
752 less than 1024--save that for the next bufferful. */ | 753 less than 1024--save that for the next bufferful. */ |
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) |
760 goto give_up; | 761 goto give_up; |
761 | 762 |
777 | 778 |
778 if (!NILP (buffer)) | 779 if (!NILP (buffer)) |
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; |
786 | 787 |
787 XSETBUFFER (buf, current_buffer); | 788 XSETBUFFER (buf, current_buffer); |
824 } | 825 } |
825 | 826 |
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 { |
843 if (first) | 840 if (first) |
844 prepare_menu_bars (); | 841 prepare_menu_bars (); |