clean removes duplicates from the stringSet.
(isSuffix bool)
| 778 | |
| 779 | // clean removes duplicates from the stringSet. |
| 780 | func (s *stringSet) clean(isSuffix bool) { |
| 781 | t := *s |
| 782 | if isSuffix { |
| 783 | sort.Sort((*bySuffix)(s)) |
| 784 | } else { |
| 785 | sort.Sort((*byPrefix)(s)) |
| 786 | } |
| 787 | w := 0 |
| 788 | for _, str := range t { |
| 789 | if w == 0 || t[w-1] != str { |
| 790 | t[w] = str |
| 791 | w++ |
| 792 | } |
| 793 | } |
| 794 | *s = t[:w] |
| 795 | } |
| 796 | |
| 797 | // size returns the number of strings in s. |
| 798 | func (s stringSet) size() int { |
no outgoing calls
no test coverage detected