summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-styles.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-07-15 19:09:24 +0000
committerRichard M. Stallman <rms@gnu.org>1997-07-15 19:09:24 +0000
commitb0c23721e86124e61288b3c0c51c5846c73ccb16 (patch)
tree227d4d8cf9639e9a0b00c8c169fecadca415b272 /lisp/progmodes/cc-styles.el
parentca85cf8a5a49c199e58a24b2d2a41b70a6ec548a (diff)
downloademacs-b0c23721e86124e61288b3c0c51c5846c73ccb16.tar.gz
(c-copy-tree): Fix bugs.
Diffstat (limited to 'lisp/progmodes/cc-styles.el')
-rw-r--r--lisp/progmodes/cc-styles.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index 8d823fe65d4..d9943b39236 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -579,23 +579,23 @@ offset for that syntactic element. Optional ADD says to add SYMBOL to
;; c-mode-common-hook or {c,c++,objc,java}-mode-hook.
(c-set-style c-site-default-style))))
-(defun c-copy-tree (tree &optional vecp)
+(defun c-copy-tree (tree)
"Make a copy of TREE.
If TREE is a cons cell, this recursively copies both its car and its cdr.
Contrast to copy-sequence, which copies only along the cdrs. With second
argument VECP, this copies vectors as well as conses."
(if (consp tree)
- (let ((p (setq tree (copy-list tree))))
+ (let ((p tree) result)
(while (consp p)
- (if (or (consp (car p)) (and vecp (vectorp (car p))))
- (setcar p (c-copy-tree (car p) vecp)))
- (or (listp (cdr p)) (setcdr p (c-copy-tree (cdr p) vecp)))
- (setq p (cdr p))))
- (if (and vecp (vectorp tree))
- (let ((i (length (setq tree (copy-sequence tree)))))
- (while (>= (setq i (1- i)) 0)
- (aset tree i (c-copy-tree (aref tree i) vecp))))))
- tree)
+ (setq result (cons (if (consp (car p))
+ (c-copy-tree (car p))
+ (car p))
+ result))
+ (setq p (cdr p)))
+ (if (null p)
+ (nreverse result)
+ (nconc (nreverse result) p)))
+ tree))
(defun c-make-styles-buffer-local ()
"Make all CC Mode style variables buffer local.