diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index a6e53306..aac6fc38 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -42,17 +42,6 @@ endfunction let s:default_includes = [ '.', '..', 'include', 'includes', \ '../include', '../includes' ] -" uniquify the input list -function! s:Unique(list) - let l = [] - for elem in a:list - if index(l, elem) == -1 - let l = add(l, elem) - endif - endfor - return l -endfunction - " convenience function to determine the 'null device' parameter " based on the current operating system function! syntastic#c#GetNullDevice() @@ -78,7 +67,7 @@ function! syntastic#c#GetIncludeDirs(filetype) call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) endif - return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ') + return join(map(syntastic#util#unique(include_dirs), '"-I" . v:val'), ' ') endfunction " read additional compiler flags from the given configuration file diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index c73eb6ce..8240188b 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -129,13 +129,13 @@ function! syntastic#util#compareErrorItems(a, b) endif endfunction -" List of buffers referenced by the location list +" Returns unique elements in a list function! syntastic#util#unique(list) let seen = {} for e in a:list let seen[e] = 1 endfor - return keys(seen) + return copy(keys(seen)) endfunction function! syntastic#util#debug(msg)