emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el


From: Thien-Thi Nguyen
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/ewoc.el
Date: Sat, 27 May 2006 10:09:22 +0000

Index: emacs/lisp/emacs-lisp/ewoc.el
diff -u emacs/lisp/emacs-lisp/ewoc.el:1.32 emacs/lisp/emacs-lisp/ewoc.el:1.33
--- emacs/lisp/emacs-lisp/ewoc.el:1.32  Sat May 27 09:36:11 2006
+++ emacs/lisp/emacs-lisp/ewoc.el       Sat May 27 10:09:22 2006
@@ -139,15 +139,10 @@
 (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 @@
 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)))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]