Function: semantic-unique-tag-table

semantic-unique-tag-table is a byte-compiled function defined in sort.el.gz.

Signature

(semantic-unique-tag-table TAGS)

Documentation

Scan a list of TAGS, removing duplicates.

This must first sort the tags by position ascending. TAGS are removed only if they are equivalent, as can happen when multiple tag sources are scanned. For more complex uniqueness testing used by the semanticdb typecaching system, see semanticdb-typecache-merge-streams.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/sort.el.gz
(defun semantic-unique-tag-table (tags)
  "Scan a list of TAGS, removing duplicates.
This must first sort the tags by position ascending.
TAGS are removed only if they are equivalent, as can happen when
multiple tag sources are scanned.
For more complex uniqueness testing used by the semanticdb
typecaching system, see `semanticdb-typecache-merge-streams'."
  (let ((sorted (sort (copy-sequence tags)
		      (lambda (a b)
			(cond ((not (semantic-tag-with-position-p a))
			       t)
			      ((not (semantic-tag-with-position-p b))
			       nil)
			      (t
			       (< (semantic-tag-start a)
				  (semantic-tag-start b)))))))
	(uniq nil))
    (while sorted
      (if (or (not uniq)
	      (not (semantic-equivalent-tag-p (car sorted) (car uniq))))
	  (setq uniq (cons (car sorted) uniq)))
      (setq sorted (cdr sorted))
      )
    (nreverse uniq)))