[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107690: * lisp/emacs-lisp/avl-tree.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107690: * lisp/emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo. |
Date: |
Tue, 27 Mar 2012 16:43:09 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107690
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11077
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-03-27 16:43:09 -0400
message:
* lisp/emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo.
(avl-tree--check, avl-tree--check-node): New funs.
modified:
lisp/ChangeLog
lisp/emacs-lisp/avl-tree.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-03-27 09:22:01 +0000
+++ b/lisp/ChangeLog 2012-03-27 20:43:09 +0000
@@ -1,8 +1,14 @@
+2012-03-27 Stefan Monnier <address@hidden>
+
+ * emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo
+ (bug#11077).
+ (avl-tree--check, avl-tree--check-node): New funs.
+
2012-03-27 Martin Rudalics <address@hidden>
* window.el (switch-to-visible-buffer): New option.
- (switch-to-prev-buffer, switch-to-next-buffer): Observe
- switch-to-visible-buffer. Make sure that checking for a window
+ (switch-to-prev-buffer, switch-to-next-buffer):
+ Observe switch-to-visible-buffer. Make sure that checking for a window
showing a buffer already is done on the same frame.
2012-03-27 Glenn Morris <address@hidden>
@@ -28,8 +34,7 @@
2012-03-25 Eli Zaretskii <address@hidden>
* makefile.w32-in (install): Use $(DIRNAME)_same-dir.tst instead
- of same-dir.tst, to avoid stepping on other (parallel) Make job's
- toes.
+ of same-dir.tst, to avoid stepping on other (parallel) Make job's toes.
2012-03-25 Chong Yidong <address@hidden>
=== modified file 'lisp/emacs-lisp/avl-tree.el'
--- a/lisp/emacs-lisp/avl-tree.el 2012-01-19 07:21:25 +0000
+++ b/lisp/emacs-lisp/avl-tree.el 2012-03-27 20:43:09 +0000
@@ -295,9 +295,9 @@
(if (> (* sgn b2) 0) (- sgn) 0)
(avl-tree--node-balance p1)
(if (< (* sgn b2) 0) sgn 0)
- (avl-tree--node-branch node branch) p2
- (avl-tree--node-balance
- (avl-tree--node-branch node branch)) 0))
+ (avl-tree--node-branch node branch) p2))
+ (setf (avl-tree--node-balance
+ (avl-tree--node-branch node branch)) 0)
nil))))
(defun avl-tree--do-enter (cmpfun root branch data &optional updatefun)
@@ -339,6 +339,16 @@
(cons nil newdata)) ; return value
))))
+(defun avl-tree--check (tree)
+ "Check the tree's balance."
+ (avl-tree--check-node (avl-tree--root tree)))
+(defun avl-tree--check-node (node)
+ (if (null node) 0
+ (let ((dl (avl-tree--check-node (avl-tree--node-left node)))
+ (dr (avl-tree--check-node (avl-tree--node-right node))))
+ (assert (= (- dr dl) (avl-tree--node-balance node)))
+ (1+ (max dl dr)))))
+
;; ----------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107690: * lisp/emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo.,
Stefan Monnier <=