Function: queue-copy

queue-copy is a byte-compiled function defined in queue.el.

Signature

(queue-copy QUEUE)

Documentation

Return a copy of QUEUE.

The new queue contains the elements of QUEUE in the same order. The elements themselves are *not* copied.

Source Code

;; Defined in ~/.emacs.d/elpa/queue-0.2/queue.el
(defun queue-copy (queue)
  "Return a copy of QUEUE.
The new queue contains the elements of QUEUE in the same
order. The elements themselves are *not* copied."
  (let ((q (queue-create))
	(list (queue-head queue)))
    (when (queue-head queue)
      (setf (queue-head q) (cons (car (queue-head queue)) nil)
	    (queue-tail q) (queue-head q))
      (while (setq list (cdr list))
	(setf (queue-tail q)
	      (setcdr (queue-tail q) (cons (car list) nil)))))
    q))