[COMMIT] Use alloca_{rawbytes, ibytes} in #'copy-file, #'insert-file-contents-internal
10 years, 11 months
Aidan Kehoe
Thank you for the input, Stephen!
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390240387 0
# Node ID 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4
# Parent 580ebed3500a224370cc7f4a6f7ad84f5ecf7530
Use alloca_{rawbytes,ibytes} in #'copy-file, #'insert-file-contents-internal
src/ChangeLog addition:
2014-01-20 Aidan Kehoe <kehoea(a)parhasard.net>
* 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).
diff -r 580ebed3500a -r 0853e1ec8529 src/ChangeLog
--- a/src/ChangeLog Sat Jan 18 17:40:41 2014 +0100
+++ b/src/ChangeLog Mon Jan 20 17:53:07 2014 +0000
@@ -1,3 +1,12 @@
+2014-01-20 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * 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 <kehoea(a)parhasard.net>
* fileio.c (READ_BUF_SIZE):
diff -r 580ebed3500a -r 0853e1ec8529 src/fileio.c
--- a/src/fileio.c Sat Jan 18 17:40:41 2014 +0100
+++ b/src/fileio.c Mon Jan 20 17:53:07 2014 +0000
@@ -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)
{
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Correct ChangeLog, use explicit hex constant for READ_BUF_SIZE
10 years, 11 months
Aidan Kehoe
Again, thank you Jerry!
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1390241595 0
# Node ID 7277cf461612be80403c68d3368a5b3329210e3d
# Parent 0853e1ec8529b0b7d50abe5ffdadaaee54c3d9b4
Use an explicit hexadecimal constant for READ_BUF_SIZE, correct ChangeLog.
src/ChangeLog addition:
2014-01-20 Aidan Kehoe <kehoea(a)parhasard.net>
* 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.
diff -r 0853e1ec8529 -r 7277cf461612 src/ChangeLog
--- a/src/ChangeLog Mon Jan 20 17:53:07 2014 +0000
+++ b/src/ChangeLog Mon Jan 20 18:13:15 2014 +0000
@@ -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 <kehoea(a)parhasard.net>
* 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 0853e1ec8529 -r 7277cf461612 src/fileio.c
--- a/src/fileio.c Mon Jan 20 17:53:07 2014 +0000
+++ b/src/fileio.c Mon Jan 20 18:13:15 2014 +0000
@@ -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", /*
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: 2 new changesets
10 years, 11 months
Bitbucket
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 <kehoea(a)parhasard.net>
* 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 <kehoea(a)parhasard.net>
+
+ * 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 <kehoea(a)parhasard.net>
* 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 <kehoea(a)parhasard.net>
* 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 <kehoea(a)parhasard.net>
* 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.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/cc-mode: acm: Bind open-paren-in-column-0-is-defun-start to nil at some entry points.
10 years, 11 months
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/c4ec2b121c78/
Changeset: c4ec2b121c78
User: acm
Date: 2014-01-19 13:09:30
Summary: Bind open-paren-in-column-0-is-defun-start to nil at some entry points.
cc-engine.el (c-invalidate-state-cache-1, c-parse-state-1)
(c-guess-basic-syntax): Bind it here.
cc-mode.el (c-before-change, c-after-change, c-font-lock-fontify-region):
Bind it here.
Affected #: 2 files
diff -r 0461a5d4fe96e0b75a6d012ba147a9bba2e5ba7d -r c4ec2b121c78037c898bded82474eff79e1df0fb cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -3189,7 +3189,8 @@
;;; Truncate `c-state-cache' and set `c-state-cache-good-pos' to a value below
;;; `here'. To maintain its consistency, we may need to insert a new brace
;;; pair.
- (let ((here-bol (c-point 'bol here))
+ (let (open-paren-in-column-0-is-defun-start
+ (here-bol (c-point 'bol here))
too-high-pa ; recorded {/(/[ next above here, or nil.
dropped-cons ; was the last removed element a brace pair?
pa)
@@ -3260,6 +3261,7 @@
;; This function might do hidden buffer changes.
(let* ((here (point))
(here-bopl (c-point 'bopl))
+ open-paren-in-column-0-is-defun-start
strategy ; 'forward, 'backward etc..
;; Candidate positions to start scanning from:
cache-pos ; highest position below HERE already existing in
@@ -9405,6 +9407,7 @@
(c-save-buffer-state
((indent-point (point))
(case-fold-search nil)
+ open-paren-in-column-0-is-defun-start
;; A whole ugly bunch of various temporary variables. Have
;; to declare them here since it's not possible to declare
;; a variable with only the scope of a cond test and the
diff -r 0461a5d4fe96e0b75a6d012ba147a9bba2e5ba7d -r c4ec2b121c78037c898bded82474eff79e1df0fb cc-mode.el
--- a/cc-mode.el
+++ b/cc-mode.el
@@ -1054,9 +1054,10 @@
(buffer-substring-no-properties beg end)))))))
(if c-get-state-before-change-functions
- (mapc (lambda (fn)
- (funcall fn beg end))
- c-get-state-before-change-functions))
+ (let (open-paren-in-column-0-is-defun-start)
+ (mapc (lambda (fn)
+ (funcall fn beg end))
+ c-get-state-before-change-functions)))
)))
;; The following must be done here rather than in `c-after-change' because
;; newly inserted parens would foul up the invalidation algorithm.
@@ -1082,7 +1083,7 @@
;; This typically sets `syntax-table' properties.
(setq c-just-done-before-change nil)
- (c-save-buffer-state (case-fold-search)
+ (c-save-buffer-state (case-fold-search open-paren-in-column-0-is-defun-start)
;; When `combine-after-change-calls' is used we might get calls
;; with regions outside the current narrowing. This has been
;; observed in Emacs 20.7.
@@ -1199,7 +1200,8 @@
;;
;; Type a space in the first blank line, and the fontification of the next
;; line was fouled up by context fontification.
- (let ((new-beg beg) (new-end end) new-region case-fold-search)
+ (let ((new-beg beg) (new-end end) new-region case-fold-search
+ open-paren-in-column-0-is-defun-start)
(if c-in-after-change-fontification
(setq c-in-after-change-fontification nil)
(save-restriction
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: [COMMIT] Increase READ_BUF_SIZE, used in #'insert-file-contents-internal, to #x10000
10 years, 11 months
Aidan Kehoe
Ar an séú lá déag de mí Eanair, scríobh Jerry James:
> On Thu, Jan 16, 2014 at 1:39 PM, Aidan Kehoe <kehoea(a)parhasard.net> wrote:
> >
> > -/* Stack sizes > 2**16 is a good way to elicit compiler bugs */
> > -/* #define READ_BUF_SIZE (2 << 16) */
> > -#define READ_BUF_SIZE (1 << 15)
> > +#define READ_BUF_SIZE (2 << 16)
> >
>
> (2 << 16) != 2**16 == #x10000. That would be (1 << 16); what you have
> there is 2**17 == #x20000.
That is an odd size for the original code! My mistake, indeed, though it
works fine and is even better for my use case than #x10000. What about the
following, since alloca_* is more careful about not blowing the stack, and
its use shows better intentionality? (Though both buffers actually remain on
the stack, with current thresholds.)
diff -r 580ebed3500a src/fileio.c
--- a/src/fileio.c Sat Jan 18 17:40:41 2014 +0100
+++ b/src/fileio.c Sat Jan 18 18:34:37 2014 +0000
@@ -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)
{
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[AC] Bug fix in menubar.el
10 years, 11 months
Michael Sperber
Byrel Mitchell <byrel.mitchell(a)gmail.com> writes:
> A couple functions in menubar.el (add-menu-item-1, and delete-menu-item)
> assume that any operations on a top-level menu are operations on
> current-menubar, and so overwrite it, regardless of whether this menu was
> passed in as an argument.
>
> A test case:
>
> (progn (setq my-menu '(("File" "---")))
> (add-submenu nil '("Edit" "Editting") nil my-menu)
> (delete-menu-item '("File") my-menu)
> (and (assoc "Edit" my-menu) (not (assoc "File" my-menu))))
>
> This should return t; it removes one submenu and adds another. On a 21.5.34
> system, however, it will return nil as both add-submenu and
> delete-menu-item will fail to operate on the local menu. (It won't in fact
> clobber the current menu; this example's safe.)
>
> I'm attaching a patch to fix this.
Thanks - I've applied and pushed the fix.
--
Regards,
Mike
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: sperber: Bug fix in menubar.el
10 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/580ebed3500a/
Changeset: 580ebed3500a
User: sperber
Date: 2014-01-18 17:40:41
Summary: Bug fix in menubar.el
2013-12-30 Byrel Mitchell <byrel.mitchell(a)gmail.com>
* menubar.el (add-menu-item-1, delete-menu-item): Do not assume
every top-level menu is on current-menubar.
Affected #: 2 files
diff -r e9d0228c56716b3b9468a1ee64b35722abde5cab -r 580ebed3500a224370cc7f4a6f7ad84f5ecf7530 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-30 Byrel Mitchell <byrel.mitchell(a)gmail.com>
+
+ * menubar.el (add-menu-item-1, delete-menu-item): Do not assume
+ every top-level menu is on current-menubar.
+
2013-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el:
diff -r e9d0228c56716b3b9468a1ee64b35722abde5cab -r 580ebed3500a224370cc7f4a6f7ad84f5ecf7530 lisp/menubar.el
--- a/lisp/menubar.el
+++ b/lisp/menubar.el
@@ -233,7 +233,7 @@
)))
(unless menubar
(error "`current-menubar' is nil: can't add menus to it."))
- (unless menu
+ (unless menu ; If we don't have all intervening submenus needed by menu-path, add them.
(let ((rest menu-path)
(so-far menubar))
(while rest
@@ -244,7 +244,7 @@
(car (find-menu-item (cdr so-far) (list (car rest))))))
(unless menu
(let ((rest2 so-far))
- (while (and (cdr rest2) (car (cdr rest2)))
+ (while (and (cdr rest2) (car (cdr rest2))) ; Walk rest2 down so-far till rest2 is the last item before divider or end of list.
(setq rest2 (cdr rest2)))
(setcdr rest2
(nconc (list (setq menu (list (car rest))))
@@ -253,15 +253,13 @@
(setq rest (cdr rest)))))
(if (and item-found (car item-found))
;; hack the item in place.
- (if menu
+ (if (or menu (not (eq (car item-found) (car menubar)))) ;If either replacing in submenu, or replacing non-initial top-level item.
;; Isn't it very bad form to use nsubstitute for side effects?
- (nsubstitute new-item (car item-found) menu)
- (setq current-menubar (nsubstitute new-item
- (car item-found)
- current-menubar)))
+ (nsubstitute new-item (car item-found) (or menu menubar))
+ (setcar menubar new-item))
;; OK, we have to add the whole thing...
;; if BEFORE is specified, try to add it there.
- (unless menu (setq menu current-menubar))
+ (unless menu (setq menu menubar))
(when before
(setq before (car (find-menu-item menu (list before)))))
(let ((rest menu)
@@ -275,8 +273,9 @@
(when (not added-before)
;; adding before the first item on the menubar itself is harder
(if (and (eq menu menubar) (eq before (car menu)))
- (setq menu (cons new-item menu)
- current-menubar menu)
+ (let ((old-car (cons (car menubar) (cdr menubar))))
+ (setcar menubar new-item)
+ (setcdr menubar old-car))
;; otherwise, add the item to the end.
(nconc menu (list new-item))))))
(set-menubar-dirty-flag)
@@ -342,17 +341,17 @@
menu paths.
FROM-MENU, if provided, means use that instead of `current-menubar'
as the menu to change."
- (let* ((pair (condition-case nil (find-menu-item (or from-menu
- current-menubar) path)
+ (let* ((menubar (or from-menu current-menubar))
+ (pair (condition-case nil (find-menu-item menubar path)
(error nil)))
(item (car pair))
- (parent (or (cdr pair) current-menubar)))
+ (parent (or (cdr pair) menubar)))
(if (not item)
nil
- ;; the menubar is the only special case, because other menus begin
- ;; with their name.
- (if (eq parent current-menubar)
- (setq current-menubar (delete* item parent))
+ (if (eq item (car menubar)) ; Deleting first item from a top-level menubar
+ (progn
+ (setcar menubar (car (cdr menubar)))
+ (setcdr menubar (cdr (cdr menubar))))
(delete* item parent))
(set-menubar-dirty-flag)
item)))
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.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Use a larger buffering size in #'copy-file too.
10 years, 11 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1389906183 0
# Node ID e9d0228c56716b3b9468a1ee64b35722abde5cab
# Parent 319e18d08654e2b6b6a20bc496349fcc959ed69f
Use a larger buffering size in #'copy-file too.
src/ChangeLog addition:
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* fileio.c (READ_BUF_SIZE):
[...]
Use it in #'copy-file too, move its #define earlier to make that
possible. Not relevant to the coding system buffering, but still
helpful.
diff -r 319e18d08654 -r e9d0228c5671 src/ChangeLog
--- a/src/ChangeLog Thu Jan 16 20:26:27 2014 +0000
+++ b/src/ChangeLog Thu Jan 16 21:03:03 2014 +0000
@@ -6,6 +6,10 @@
of #x10000, and that size works better with the coding system
buffering, improving performance there; move to this value.
+ Use it in #'copy-file too, move its #define earlier to make that
+ possible. Not relevant to the coding system buffering, but still
+ helpful.
+
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
diff -r 319e18d08654 -r e9d0228c5671 src/fileio.c
--- a/src/fileio.c Thu Jan 16 20:26:27 2014 +0000
+++ b/src/fileio.c Thu Jan 16 21:03:03 2014 +0000
@@ -1785,6 +1785,8 @@
}
return;
}
+
+#define READ_BUF_SIZE (2 << 16)
DEFUN ("copy-file", Fcopy_file, 2, 4,
"fCopy file: \nFCopy %s to file: \np\nP", /*
@@ -1801,7 +1803,7 @@
{
/* This function can call Lisp. GC checked 2000-07-28 ben */
int ifd, ofd, n;
- Rawbyte buf[16 * 1024];
+ Rawbyte buf[READ_BUF_SIZE];
struct stat st, out_st;
Lisp_Object handler;
int speccount = specpdl_depth ();
@@ -2870,8 +2872,6 @@
}
-#define READ_BUF_SIZE (2 << 16)
-
DEFUN ("insert-file-contents-internal", Finsert_file_contents_internal,
1, 7, 0, /*
Insert contents of file FILENAME after point; no coding-system frobbing.
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: kehoea: Use a larger buffering size in #'copy-file too.
10 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/e9d0228c5671/
Changeset: e9d0228c5671
User: kehoea
Date: 2014-01-16 22:03:03
Summary: Use a larger buffering size in #'copy-file too.
src/ChangeLog addition:
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* fileio.c (READ_BUF_SIZE):
[...]
Use it in #'copy-file too, move its #define earlier to make that
possible. Not relevant to the coding system buffering, but still
helpful.
Affected #: 2 files
diff -r 319e18d08654e2b6b6a20bc496349fcc959ed69f -r e9d0228c56716b3b9468a1ee64b35722abde5cab src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -6,6 +6,10 @@
of #x10000, and that size works better with the coding system
buffering, improving performance there; move to this value.
+ Use it in #'copy-file too, move its #define earlier to make that
+ possible. Not relevant to the coding system buffering, but still
+ helpful.
+
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
diff -r 319e18d08654e2b6b6a20bc496349fcc959ed69f -r e9d0228c56716b3b9468a1ee64b35722abde5cab src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1785,6 +1785,8 @@
}
return;
}
+
+#define READ_BUF_SIZE (2 << 16)
DEFUN ("copy-file", Fcopy_file, 2, 4,
"fCopy file: \nFCopy %s to file: \np\nP", /*
@@ -1801,7 +1803,7 @@
{
/* This function can call Lisp. GC checked 2000-07-28 ben */
int ifd, ofd, n;
- Rawbyte buf[16 * 1024];
+ Rawbyte buf[READ_BUF_SIZE];
struct stat st, out_st;
Lisp_Object handler;
int speccount = specpdl_depth ();
@@ -2870,8 +2872,6 @@
}
-#define READ_BUF_SIZE (2 << 16)
-
DEFUN ("insert-file-contents-internal", Finsert_file_contents_internal,
1, 7, 0, /*
Insert contents of file FILENAME after point; no coding-system frobbing.
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.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] Increase READ_BUF_SIZE, used in #'insert-file-contents-internal, to #x10000
10 years, 11 months
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
This will also improve performance for large VM buffers, and I wouldn’t be
surprised if it gave the largest improvement of the changes I’ve made. It
does this by reducing the calls to Lstream_read(), and by matching the
buffer size to the coding buffer size, so there’s less (though not no) need
for adjustment of the character_tell() result due to the the two getting out
of sync.
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1389903987 0
# Node ID 319e18d08654e2b6b6a20bc496349fcc959ed69f
# Parent ccaa851ae712e870ceb65d19226426d40d8de48c
Increase READ_BUF_SIZE, used in #'insert-file-contents-internal, to #x10000
src/ChangeLog addition:
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* 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.
diff -r ccaa851ae712 -r 319e18d08654 src/ChangeLog
--- a/src/ChangeLog Thu Jan 16 19:56:06 2014 +0000
+++ b/src/ChangeLog Thu Jan 16 20:26:27 2014 +0000
@@ -1,3 +1,11 @@
+2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * 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.
+
2014-01-16 Aidan Kehoe <kehoea(a)parhasard.net>
* file-coding.c:
diff -r ccaa851ae712 -r 319e18d08654 src/fileio.c
--- a/src/fileio.c Thu Jan 16 19:56:06 2014 +0000
+++ b/src/fileio.c Thu Jan 16 20:26:27 2014 +0000
@@ -2870,9 +2870,7 @@
}
-/* Stack sizes > 2**16 is a good way to elicit compiler bugs */
-/* #define READ_BUF_SIZE (2 << 16) */
-#define READ_BUF_SIZE (1 << 15)
+#define READ_BUF_SIZE (2 << 16)
DEFUN ("insert-file-contents-internal", Finsert_file_contents_internal,
1, 7, 0, /*
--
‘Liston operated so fast that he once accidentally amputated an assistant’s
fingers along with a patient’s leg, […] The patient and the assistant both
died of sepsis, and a spectator reportedly died of shock, resulting in the
only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches