Mercurial > vim
diff src/misc1.c @ 5873:8e9db1f27a00 v7.4.279
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 07 May 2014 18:35:30 +0200 |
parents | a6b59ee633a3 |
children | 5cb1828fd005 |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -10336,9 +10336,6 @@ expand_in_path(gap, pattern, flags) { char_u *curdir; garray_T path_ga; - char_u *files = NULL; - char_u *s; /* start */ - char_u *e; /* end */ char_u *paths = NULL; if ((curdir = alloc((unsigned)MAXPATHL)) == NULL) @@ -10351,37 +10348,13 @@ expand_in_path(gap, pattern, flags) if (path_ga.ga_len == 0) return 0; - paths = ga_concat_strings(&path_ga); + paths = ga_concat_strings(&path_ga, ","); ga_clear_strings(&path_ga); if (paths == NULL) return 0; - files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0); + globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0); vim_free(paths); - if (files == NULL) - return 0; - - /* Copy each path in files into gap */ - s = e = files; - while (*s != NUL) - { - while (*e != '\n' && *e != NUL) - e++; - if (*e == NUL) - { - addfile(gap, s, flags); - break; - } - else - { - /* *e is '\n' */ - *e = NUL; - addfile(gap, s, flags); - e++; - s = e; - } - } - vim_free(files); return gap->ga_len; }