* lisp/emacs-lisp/avl-tree.el (avl-tree--enter-balance): Fix paren typo.
(avl-tree--check, avl-tree--check-node): New funs. Fixes: debbugs:11077
This commit is contained in:
parent
5d956bc22e
commit
b973155e95
2 changed files with 22 additions and 7 deletions
|
|
@ -1,8 +1,14 @@
|
|||
2012-03-27 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* 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 <rudalics@gmx.at>
|
||||
|
||||
* 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 <rgm@gnu.org>
|
||||
|
|
@ -28,8 +34,7 @@
|
|||
2012-03-25 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* 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 <cyd@gnu.org>
|
||||
|
||||
|
|
|
|||
|
|
@ -295,9 +295,9 @@ Return t if the height of the tree has grown."
|
|||
(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 @@ inserted data."
|
|||
(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)))))
|
||||
|
||||
;; ----------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue