projects
/
gnus
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gnus-art.el (gnus-mime-buttonize-attachments-in-header): Improve criterion that finds...
[gnus]
/
lisp
/
rtree.el
diff --git
a/lisp/rtree.el
b/lisp/rtree.el
index
99ecb01
..
b143bfe
100644
(file)
--- a/
lisp/rtree.el
+++ b/
lisp/rtree.el
@@
-1,24
+1,23
@@
;;; rtree.el --- functions for manipulating range trees
;;; rtree.el --- functions for manipulating range trees
-;; Copyright (C) 2010 Free Software Foundation, Inc.
+
+;; Copyright (C) 2010-2014 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; This file is part of GNU Emacs.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software
;
you can redistribute it and/or modify
+;; GNU Emacs is free software
:
you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation
; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation
, either version 3 of the License, or
+;;
(at your option)
any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Commentary:
@@
-197,7
+196,7
@@
(setq parent successor
successor (rtree-left successor)))
;; We now have the leftmost child of our right child.
(setq parent successor
successor (rtree-left successor)))
;; We now have the leftmost child of our right child.
- (rtree-set-range (rtree-range successor))
+ (rtree-set-range
tree
(rtree-range successor))
;; Transplant the child (if any) to the parent.
(rtree-set-left parent (rtree-right successor))))
(t
;; Transplant the child (if any) to the parent.
(rtree-set-left parent (rtree-right successor))))
(t
@@
-230,7
+229,7
@@
(let ((predecessor (rtree-left tree)))
(while (rtree-right predecessor)
(setq predecessor (rtree-right predecessor)))
(let ((predecessor (rtree-left tree)))
(while (rtree-right predecessor)
(setq predecessor (rtree-right predecessor)))
- (rtree-set-right predecessor new-
m
ode)))
+ (rtree-set-right predecessor new-
n
ode)))
((rtree-left tree)
(rtree-set-right new-node tree)
(rtree-set-left new-node (rtree-left tree))
((rtree-left tree)
(rtree-set-right new-node tree)
(rtree-set-left new-node (rtree-left tree))
@@
-265,6
+264,15
@@
(setq tree (rtree-left tree))))
result))
(setq tree (rtree-left tree))))
result))
+(defun rtree-length (tree)
+ "Return the number of numbers stored in TREE."
+ (if (null tree)
+ 0
+ (+ (rtree-length (rtree-left tree))
+ (1+ (- (rtree-high tree)
+ (rtree-low tree)))
+ (rtree-length (rtree-right tree)))))
+
(provide 'rtree)
;;; rtree.el ends here
(provide 'rtree)
;;; rtree.el ends here