[mcclim-devel] Proposed patch to format-graph-from-roots
Robert Goldman
rpgoldman at real-time.com
Sun Sep 16 16:26:47 UTC 2007
A discussion on #lisp the other day pointed out that destructively
modifying &rest argument lists is not kosher. format-graph-from-roots
does just that.
Would anyone object to me committing the following patch?
--- graph-formatting.lisp 4 Mar 2007 22:26:22 -0000 1.20
+++ graph-formatting.lisp 16 Sep 2007 16:25:26 -0000
@@ -115,9 +115,11 @@ (define-graph-type :directed-graph digra
(define-graph-type :digraph digraph-graph-output-record)
;;;; Entry
+(defun format-graph-from-root (root-object &rest other-args)
+ (apply #'format-graph-from-roots (list root-object) other-args))
(defun format-graph-from-roots (root-objects object-printer
inferior-producer
- &rest graph-options
+ &rest rest-args
&key stream orientation cutoff-depth
merge-duplicates duplicate-key
duplicate-test
generation-separation
@@ -128,6 +130,9 @@ (defun format-graph-from-roots (root-obj
graph-type (move-cursor t)
&allow-other-keys)
(declare (ignore orientation generation-separation
within-generation-separation center-nodes))
+ ;; we were destructively modifying the &rest arg, which isn't safe,
+ ;; so I introduced the copy-list [2007/09/07:rpg]
+ (let ((graph-options (copy-list rest-args)))
;; Mungle some arguments
(check-type cutoff-depth (or null integer))
(check-type root-objects sequence)
@@ -184,7 +189,7 @@ (defun format-graph-from-roots (root-obj
(setf (stream-cursor-position stream)
(values (bounding-rectangle-max-x graph-output-record)
(bounding-rectangle-max-y graph-output-record))))
- graph-output-record)))
+ graph-output-record))))
(defun format-graph-from-root (root &rest rest)
(apply #'format-graph-from-roots (list root) rest))
@@ -248,7 +253,7 @@ (defclass standard-graph-node-output-rec
(object
:initarg :object
:reader graph-node-object)
- ;; internal slots for the graph layout algorithmn
+ ;; internal slots for the graph layout algorithm
(minor-size
:initform nil
:accessor graph-node-minor-size
Best,
R
More information about the mcclim-devel
mailing list