]> git.eshelyaron.com Git - emacs.git/commitdiff
(ewoc--node-branch): Merge into unique caller.
authorThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 27 May 2006 10:10:35 +0000 (10:10 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 27 May 2006 10:10:35 +0000 (10:10 +0000)
lisp/ChangeLog
lisp/emacs-lisp/ewoc.el

index b8720226e8da19340716d9362c4c731159363ded..7072091492c948a8262a896bfeecc8c63fe062d8 100644 (file)
@@ -5,6 +5,8 @@
 
        (ewoc-delete): Compute last node once before looping.
 
+       (ewoc--node-branch): Merge into unique caller.
+
 2006-05-27  Mathias Dahl  <mathias.dahl@gmail.com>
 
        * dired.el (dired-mode-map): Change `tumme-tag-remove' to
index a02425b0cec077f5c5f116e5c704ad365ae6c023..1e85ef813fc47a9c19e26bd546f9518f4a994070 100644 (file)
 (defvar ewoc--current-dll)
 
 (defstruct (ewoc--node
-           (:type vector)              ;required for ewoc--node-branch hack
+           (:type vector)              ;ewoc--node-nth needs this
            (:constructor ewoc--node-create (start-marker data)))
   left right data start-marker)
 
-(defalias 'ewoc--node-branch 'aref
-  "Get the left (CHILD=0) or right (CHILD=1) child of the NODE.
-
-\(fn NODE CHILD)")
-
 (defun ewoc--node-next (node)
   "Return the node after NODE, or nil if NODE is the last node."
   (let ((R (ewoc--node-right node)))
@@ -164,13 +159,14 @@ N counts from zero.  If N is negative, return the -(N+1)th last element.
 If N is out of range, return nil.
 Thus, (ewoc--node-nth 0) returns the first node,
 and (ewoc--node-nth -1) returns the last node."
+  ;; Presuming a node is ":type vector", starting with `left' and `right':
   ;; Branch 0 ("follow left pointer") is used when n is negative.
   ;; Branch 1 ("follow right pointer") is used otherwise.
   (let* ((branch (if (< n 0) 0 1))
-        (node   (ewoc--node-branch ewoc--current-dll branch)))
+        (node   (aref ewoc--current-dll branch)))
     (if (< n 0) (setq n (- -1 n)))
     (while (and (not (eq ewoc--current-dll node)) (> n 0))
-      (setq node (ewoc--node-branch node branch))
+      (setq node (aref node branch))
       (setq n (1- n)))
     (unless (eq ewoc--current-dll node) node)))