diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-04 20:59:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-04 20:59:15 +0200 |
commit | 26262f87770d3a1a68b09a70152d75c2e2ae186f (patch) | |
tree | a051b686adb302a8d050a85007aa335787ced0b4 /src/scriptfile.c | |
parent | 3f4f3d8e7e6fc0494d00cfb75669a554c8e67c8b (diff) | |
download | vim-git-26262f87770d3a1a68b09a70152d75c2e2ae186f.tar.gz |
patch 8.1.1985: code for dealing with paths is spread outv8.1.1985
Problem: Code for dealing with paths is spread out.
Solution: Move path related functions from misc1.c to filepath.c.
Remove NO_EXPANDPATH.
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r-- | src/scriptfile.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c index ca4abab1a..d46b1e0b7 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -606,6 +606,28 @@ ex_packadd(exarg_T *eap) #endif /* + * Sort "gap" and remove duplicate entries. "gap" is expected to contain a + * list of file names in allocated memory. + */ + void +remove_duplicates(garray_T *gap) +{ + int i; + int j; + char_u **fnames = (char_u **)gap->ga_data; + + sort_strings(fnames, gap->ga_len); + for (i = gap->ga_len - 1; i > 0; --i) + if (fnamecmp(fnames[i - 1], fnames[i]) == 0) + { + vim_free(fnames[i]); + for (j = i + 1; j < gap->ga_len; ++j) + fnames[j - 1] = fnames[j]; + --gap->ga_len; + } +} + +/* * Expand color scheme, compiler or filetype names. * Search from 'runtimepath': * 'runtimepath'/{dirnames}/{pat}.vim |