diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-08-04 17:07:20 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-08-04 17:07:20 +0200 |
commit | 80a7dcf8b5af473af674fb47769accc40e67cac0 (patch) | |
tree | 50884d2f3ea7aa2bd6ad9fa5c6e0180178666ddd /src/misc2.c | |
parent | 150a1321b230ce1cfd661c7da89c3684d0f2d478 (diff) | |
download | vim-git-80a7dcf8b5af473af674fb47769accc40e67cac0.tar.gz |
Make :find completion consistent between Unix and MS-Windows. Add a test.
(Nazri Ramliy)
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c index 96813a484..3c25a1f08 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2068,6 +2068,36 @@ ga_grow(gap, n) } /* + * For a growing array that contains a list of strings: concatenate all the + * strings with a separating comma. + * Returns NULL when out of memory. + */ + char_u * +ga_concat_strings(gap) + garray_T *gap; +{ + int i; + int len = 0; + char_u *s; + + for (i = 0; i < gap->ga_len; ++i) + len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + 1; + + s = alloc(len + 1); + if (s != NULL) + { + *s = NUL; + for (i = 0; i < gap->ga_len; ++i) + { + if (*s != NUL) + STRCAT(s, ","); + STRCAT(s, ((char_u **)(gap->ga_data))[i]); + } + } + return s; +} + +/* * Concatenate a string to a growarray which contains characters. * Note: Does NOT copy the NUL at the end! */ |