0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.4.279

Problem:    globpath() returns a string, making it difficult to get a list of
            matches. (Greg Novack)
Solution:   Add an optional argument like with glob(). (Adnan Zafar)
This commit is contained in:
Bram Moolenaar
2014-05-07 18:35:30 +02:00
parent 3ec7f4e402
commit 1b1063af58
10 changed files with 100 additions and 101 deletions

View File

@@ -2087,29 +2087,37 @@ ga_grow(gap, n)
/*
* For a growing array that contains a list of strings: concatenate all the
* strings with a separating comma.
* strings with a separating "sep".
* Returns NULL when out of memory.
*/
char_u *
ga_concat_strings(gap)
ga_concat_strings(gap, sep)
garray_T *gap;
char *sep;
{
int i;
int len = 0;
int sep_len = (int)STRLEN(sep);
char_u *s;
char_u *p;
for (i = 0; i < gap->ga_len; ++i)
len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + 1;
len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + sep_len;
s = alloc(len + 1);
if (s != NULL)
{
*s = NUL;
p = s;
for (i = 0; i < gap->ga_len; ++i)
{
if (*s != NUL)
STRCAT(s, ",");
STRCAT(s, ((char_u **)(gap->ga_data))[i]);
if (p != s)
{
STRCPY(p, sep);
p += sep_len;
}
STRCPY(p, ((char_u **)(gap->ga_data))[i]);
p += STRLEN(p);
}
}
return s;