commit/XEmacs: 2 new changesets

[email protected]
Newsgroups gmane.emacs.xemacs.patches
Message-ID <[email protected]>
2 new commits in XEmacs:

https://bitbucket.org/xemacs/xemacs/commits/0853e1ec8529/
Changeset:   0853e1ec8529
User:        kehoea
Date:        2014-01-20 18:53:07
Summary:     Use alloca_{rawbytes,ibytes} in #'copy-file, #'insert-file-contents-internal

src/ChangeLog addition:

2014-01-20  Aidan Kehoe  <[email protected]>

	* fileio.c (Fcopy_file, Finsert_file_contents_internal):
	Use alloca_{rawbytes,ibytes} here instead of the implicit alloca
	on the stack; doesn't change where the buffers are allocated for
	these two functions, but does mean that decisions about alloca
	vs. malloc based on buffer size are made in the same place
	(ultimately, the ALLOCA() macro).
Affected #:  2 files

diff -r 580ebed3500a224370cc7f4a6f7ad84f5ecf7530 -r 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2014-01-20  Aidan Kehoe  <[email protected]>
+
+	* fileio.c (Fcopy_file, Finsert_file_contents_internal):
+	Use alloca_{rawbytes,ibytes} here instead of the implicit alloca
+	on the stack; doesn't change where the buffers are allocated for
+	these two functions, but does mean that decisions about alloca
+	vs. malloc based on buffer size are made in the same place
+	(ultimately, the ALLOCA() macro).
+
 2014-01-16  Aidan Kehoe  <[email protected]>
 
 	* fileio.c (READ_BUF_SIZE):

diff -r 580ebed3500a224370cc7f4a6f7ad84f5ecf7530 -r 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4 src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1803,7 +1803,7 @@
 {
   /* This function can call Lisp.  GC checked 2000-07-28 ben */
   int ifd, ofd, n;
-  Rawbyte buf[READ_BUF_SIZE];
+  Rawbyte *buf = alloca_rawbytes (READ_BUF_SIZE);
   struct stat st, out_st;
   Lisp_Object handler;
   int speccount = specpdl_depth ();
@@ -1909,7 +1909,7 @@
 
     record_unwind_protect (close_file_unwind, ofd_locative);
 
-    while ((n = read_allowing_quit (ifd, buf, sizeof (buf))) > 0)
+    while ((n = read_allowing_quit (ifd, buf, READ_BUF_SIZE)) > 0)
     {
       if (write_allowing_quit (ofd, buf, n) != n)
 	report_file_error ("I/O error", newname);
@@ -2899,7 +2899,7 @@
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object val;
   int total;
-  Ibyte read_buf[READ_BUF_SIZE];
+  Ibyte *read_buf = alloca_ibytes (READ_BUF_SIZE);
   int mc_count;
   struct buffer *buf = current_buffer;
   Lisp_Object curbuf;
@@ -3199,8 +3199,7 @@
 	Charcount cc_inserted, this_tell = last_tell;
 
 	QUIT;
-	this_len = Lstream_read (XLSTREAM (stream), read_buf,
-				 sizeof (read_buf));
+	this_len = Lstream_read (XLSTREAM (stream), read_buf, READ_BUF_SIZE);
 
 	if (this_len <= 0)
 	  {


https://bitbucket.org/xemacs/xemacs/commits/7277cf461612/
Changeset:   7277cf461612
User:        kehoea
Date:        2014-01-20 19:13:15
Summary:     Use an explicit hexadecimal constant for READ_BUF_SIZE, correct ChangeLog.

src/ChangeLog addition:

2014-01-20  Aidan Kehoe  <[email protected]>

	* fileio.c
	[...]
	(READ_BUF_SIZE): Use an explicit hexadecimal constant for the
	0x20000 value for this, don't left-shift 2 16 times. Correct the
	last ChangeLog entry after Jerry James pointed out a mistake on my
	part. Thank you for review and discussion, Jerry and Stephen
	Turnbull.
Affected #:  2 files

diff -r 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4 -r 7277cf461612be80403c68d3368a5b3329210e3d src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -6,14 +6,19 @@
 	these two functions, but does mean that decisions about alloca
 	vs. malloc based on buffer size are made in the same place
 	(ultimately, the ALLOCA() macro).
+	(READ_BUF_SIZE): Use an explicit hexadecimal constant for the
+	0x20000 value for this, don't left-shift 2 16 times. Correct the
+	last ChangeLog entry after Jerry James pointed out a mistake on my
+	part. Thank you for review and discussion, Jerry and Stephen
+	Turnbull.
 
 2014-01-16  Aidan Kehoe  <[email protected]>
 
 	* fileio.c (READ_BUF_SIZE):
 	Stack sizes > 2**16 elicited bugs back in August 1996, but there's
 	nothing to indicate this is still the case. GNU uses a block size
-	of #x10000, and that size works better with the coding system
-	buffering, improving performance there; move to this value.
+	of #x10000 without problems, we can afford to be a bit more
+	adventurous with a value of #x20000.
 
 	Use it in #'copy-file too, move its #define earlier to make that
 	possible. Not relevant to the coding system buffering, but still

diff -r 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4 -r 7277cf461612be80403c68d3368a5b3329210e3d src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1786,7 +1786,7 @@
   return;
 }
 
-#define READ_BUF_SIZE (2 << 16)
+#define READ_BUF_SIZE 0x20000
 
 DEFUN ("copy-file", Fcopy_file, 2, 4,
        "fCopy file: \nFCopy %s to file: \np\nP", /*

Repository URL: https://bitbucket.org/xemacs/xemacs/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.