Karsten Hopp 982db6
To: vim_dev@googlegroups.com
Karsten Hopp 982db6
Subject: Patch 7.4.279
Karsten Hopp 982db6
Fcc: outbox
Karsten Hopp 982db6
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 982db6
Mime-Version: 1.0
Karsten Hopp 982db6
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 982db6
Content-Transfer-Encoding: 8bit
Karsten Hopp 982db6
------------
Karsten Hopp 982db6
Karsten Hopp 982db6
Patch 7.4.279
Karsten Hopp 982db6
Problem:    globpath() returns a string, making it difficult to get a list of
Karsten Hopp 982db6
	    matches. (Greg Novack)
Karsten Hopp 982db6
Solution:   Add an optional argument like with glob(). (Adnan Zafar)
Karsten Hopp 982db6
Files:	    runtime/doc/eval.txt, src/eval.c, src/ex_getln.c, src/misc1.c,
Karsten Hopp 982db6
	    src/misc2.c, src/proto/ex_getln.pro, src/proto/misc2.pro,
Karsten Hopp 982db6
	    src/testdir/test97.in, src/testdir/test97.ok
Karsten Hopp 982db6
Karsten Hopp 982db6
Karsten Hopp 982db6
*** ../vim-7.4.278/runtime/doc/eval.txt	2014-04-23 17:43:37.350948683 +0200
Karsten Hopp 982db6
--- runtime/doc/eval.txt	2014-05-07 17:38:03.045185916 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 1832,1838 ****
Karsten Hopp 982db6
  				any	variable {varname} in window {nr}
Karsten Hopp 982db6
  glob( {expr} [, {nosuf} [, {list}]])
Karsten Hopp 982db6
  				any	expand file wildcards in {expr}
Karsten Hopp 982db6
! globpath( {path}, {expr} [, {flag}])
Karsten Hopp 982db6
  				String	do glob({expr}) for all dirs in {path}
Karsten Hopp 982db6
  has( {feature})			Number	TRUE if feature {feature} supported
Karsten Hopp 982db6
  has_key( {dict}, {key})		Number	TRUE if {dict} has entry {key}
Karsten Hopp 982db6
--- 1832,1838 ----
Karsten Hopp 982db6
  				any	variable {varname} in window {nr}
Karsten Hopp 982db6
  glob( {expr} [, {nosuf} [, {list}]])
Karsten Hopp 982db6
  				any	expand file wildcards in {expr}
Karsten Hopp 982db6
! globpath( {path}, {expr} [, {nosuf} [, {list}]])
Karsten Hopp 982db6
  				String	do glob({expr}) for all dirs in {path}
Karsten Hopp 982db6
  has( {feature})			Number	TRUE if feature {feature} supported
Karsten Hopp 982db6
  has_key( {dict}, {key})		Number	TRUE if {dict} has entry {key}
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 3570,3580 ****
Karsten Hopp 982db6
  		See |expand()| for expanding special Vim variables.  See
Karsten Hopp 982db6
  		|system()| for getting the raw output of an external command.
Karsten Hopp 982db6
  
Karsten Hopp 982db6
! globpath({path}, {expr} [, {flag}])			*globpath()*
Karsten Hopp 982db6
  		Perform glob() on all directories in {path} and concatenate
Karsten Hopp 982db6
  		the results.  Example: >
Karsten Hopp 982db6
  			:echo globpath(&rtp, "syntax/c.vim")
Karsten Hopp 982db6
! <		{path} is a comma-separated list of directory names.  Each
Karsten Hopp 982db6
  		directory name is prepended to {expr} and expanded like with
Karsten Hopp 982db6
  		|glob()|.  A path separator is inserted when needed.
Karsten Hopp 982db6
  		To add a comma inside a directory name escape it with a
Karsten Hopp 982db6
--- 3571,3582 ----
Karsten Hopp 982db6
  		See |expand()| for expanding special Vim variables.  See
Karsten Hopp 982db6
  		|system()| for getting the raw output of an external command.
Karsten Hopp 982db6
  
Karsten Hopp 982db6
! globpath({path}, {expr} [, {nosuf} [, {list}]])			*globpath()*
Karsten Hopp 982db6
  		Perform glob() on all directories in {path} and concatenate
Karsten Hopp 982db6
  		the results.  Example: >
Karsten Hopp 982db6
  			:echo globpath(&rtp, "syntax/c.vim")
Karsten Hopp 982db6
! <
Karsten Hopp 982db6
! 		{path} is a comma-separated list of directory names.  Each
Karsten Hopp 982db6
  		directory name is prepended to {expr} and expanded like with
Karsten Hopp 982db6
  		|glob()|.  A path separator is inserted when needed.
Karsten Hopp 982db6
  		To add a comma inside a directory name escape it with a
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 3582,3592 ****
Karsten Hopp 982db6
  		trailing backslash, remove it if you put a comma after it.
Karsten Hopp 982db6
  		If the expansion fails for one of the directories, there is no
Karsten Hopp 982db6
  		error message.
Karsten Hopp 982db6
! 		Unless the optional {flag} argument is given and is non-zero,
Karsten Hopp 982db6
  		the 'suffixes' and 'wildignore' options apply: Names matching
Karsten Hopp 982db6
  		one of the patterns in 'wildignore' will be skipped and
Karsten Hopp 982db6
  		'suffixes' affect the ordering of matches.
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  		The "**" item can be used to search in a directory tree.
Karsten Hopp 982db6
  		For example, to find all "README.txt" files in the directories
Karsten Hopp 982db6
  		in 'runtimepath' and below: >
Karsten Hopp 982db6
--- 3584,3602 ----
Karsten Hopp 982db6
  		trailing backslash, remove it if you put a comma after it.
Karsten Hopp 982db6
  		If the expansion fails for one of the directories, there is no
Karsten Hopp 982db6
  		error message.
Karsten Hopp 982db6
! 
Karsten Hopp 982db6
! 		Unless the optional {nosuf} argument is given and is non-zero,
Karsten Hopp 982db6
  		the 'suffixes' and 'wildignore' options apply: Names matching
Karsten Hopp 982db6
  		one of the patterns in 'wildignore' will be skipped and
Karsten Hopp 982db6
  		'suffixes' affect the ordering of matches.
Karsten Hopp 982db6
  
Karsten Hopp 982db6
+ 		When {list} is present and it is non-zero the result is a List
Karsten Hopp 982db6
+ 		with all matching files. The advantage of using a List is, you
Karsten Hopp 982db6
+ 		also get filenames containing newlines correctly. Otherwise
Karsten Hopp 982db6
+ 		the result is a String and when there are several matches,
Karsten Hopp 982db6
+ 		they are separated by <NL> characters.  Example: >
Karsten Hopp 982db6
+ 			:echo globpath(&rtp, "syntax/c.vim", 0, 1)
Karsten Hopp 982db6
+ <
Karsten Hopp 982db6
  		The "**" item can be used to search in a directory tree.
Karsten Hopp 982db6
  		For example, to find all "README.txt" files in the directories
Karsten Hopp 982db6
  		in 'runtimepath' and below: >
Karsten Hopp 982db6
*** ../vim-7.4.278/src/eval.c	2014-05-07 17:31:32.473182497 +0200
Karsten Hopp 982db6
--- src/eval.c	2014-05-07 18:06:29.541200854 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 7985,7991 ****
Karsten Hopp 982db6
      {"getwinposy",	0, 0, f_getwinposy},
Karsten Hopp 982db6
      {"getwinvar",	2, 3, f_getwinvar},
Karsten Hopp 982db6
      {"glob",		1, 3, f_glob},
Karsten Hopp 982db6
!     {"globpath",	2, 3, f_globpath},
Karsten Hopp 982db6
      {"has",		1, 1, f_has},
Karsten Hopp 982db6
      {"has_key",		2, 2, f_has_key},
Karsten Hopp 982db6
      {"haslocaldir",	0, 0, f_haslocaldir},
Karsten Hopp 982db6
--- 7985,7991 ----
Karsten Hopp 982db6
      {"getwinposy",	0, 0, f_getwinposy},
Karsten Hopp 982db6
      {"getwinvar",	2, 3, f_getwinvar},
Karsten Hopp 982db6
      {"glob",		1, 3, f_glob},
Karsten Hopp 982db6
!     {"globpath",	2, 4, f_globpath},
Karsten Hopp 982db6
      {"has",		1, 1, f_has},
Karsten Hopp 982db6
      {"has_key",		2, 2, f_has_key},
Karsten Hopp 982db6
      {"haslocaldir",	0, 0, f_haslocaldir},
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 12151,12168 ****
Karsten Hopp 982db6
      char_u	buf1[NUMBUFLEN];
Karsten Hopp 982db6
      char_u	*file = get_tv_string_buf_chk(&argvars[1], buf1);
Karsten Hopp 982db6
      int		error = FALSE;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      /* When the optional second argument is non-zero, don't remove matches
Karsten Hopp 982db6
      * for 'wildignore' and don't put matches for 'suffixes' at the end. */
Karsten Hopp 982db6
-     if (argvars[2].v_type != VAR_UNKNOWN
Karsten Hopp 982db6
- 				&& get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 982db6
- 	flags |= WILD_KEEP_ALL;
Karsten Hopp 982db6
      rettv->v_type = VAR_STRING;
Karsten Hopp 982db6
!     if (file == NULL || error)
Karsten Hopp 982db6
! 	rettv->vval.v_string = NULL;
Karsten Hopp 982db6
      else
Karsten Hopp 982db6
! 	rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
Karsten Hopp 982db6
! 								       flags);
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
--- 12151,12187 ----
Karsten Hopp 982db6
      char_u	buf1[NUMBUFLEN];
Karsten Hopp 982db6
      char_u	*file = get_tv_string_buf_chk(&argvars[1], buf1);
Karsten Hopp 982db6
      int		error = FALSE;
Karsten Hopp 982db6
+     garray_T	ga;
Karsten Hopp 982db6
+     int		i;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      /* When the optional second argument is non-zero, don't remove matches
Karsten Hopp 982db6
      * for 'wildignore' and don't put matches for 'suffixes' at the end. */
Karsten Hopp 982db6
      rettv->v_type = VAR_STRING;
Karsten Hopp 982db6
!     if (argvars[2].v_type != VAR_UNKNOWN)
Karsten Hopp 982db6
!     {
Karsten Hopp 982db6
! 	if (get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 982db6
! 	    flags |= WILD_KEEP_ALL;
Karsten Hopp 982db6
! 	if (argvars[3].v_type != VAR_UNKNOWN
Karsten Hopp 982db6
! 				    && get_tv_number_chk(&argvars[3], &error))
Karsten Hopp 982db6
! 	{
Karsten Hopp 982db6
! 	    rettv->v_type = VAR_LIST;
Karsten Hopp 982db6
! 	    rettv->vval.v_list = NULL;
Karsten Hopp 982db6
! 	}
Karsten Hopp 982db6
!     }
Karsten Hopp 982db6
!     if (file != NULL && !error)
Karsten Hopp 982db6
!     {
Karsten Hopp 982db6
! 	ga_init2(&ga, (int)sizeof(char_u *), 10);
Karsten Hopp 982db6
! 	globpath(get_tv_string(&argvars[0]), file, &ga, flags);
Karsten Hopp 982db6
! 	if (rettv->v_type == VAR_STRING)
Karsten Hopp 982db6
! 	    rettv->vval.v_string = ga_concat_strings(&ga, "\n");
Karsten Hopp 982db6
! 	else if (rettv_list_alloc(rettv) != FAIL)
Karsten Hopp 982db6
! 	    for (i = 0; i < ga.ga_len; ++i)
Karsten Hopp 982db6
! 		list_append_string(rettv->vval.v_list,
Karsten Hopp 982db6
! 					    ((char_u **)(ga.ga_data))[i], -1);
Karsten Hopp 982db6
! 	ga_clear_strings(&ga);
Karsten Hopp 982db6
!     }
Karsten Hopp 982db6
      else
Karsten Hopp 982db6
! 	rettv->vval.v_string = NULL;
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
*** ../vim-7.4.278/src/ex_getln.c	2013-11-12 05:28:08.000000000 +0100
Karsten Hopp 982db6
--- src/ex_getln.c	2014-05-07 18:11:49.281203653 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 5095,5103 ****
Karsten Hopp 982db6
      char_u	***file;
Karsten Hopp 982db6
      char	*dirnames[];
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
-     char_u	*matches;
Karsten Hopp 982db6
      char_u	*s;
Karsten Hopp 982db6
      char_u	*e;
Karsten Hopp 982db6
      garray_T	ga;
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
      int		pat_len;
Karsten Hopp 982db6
--- 5095,5103 ----
Karsten Hopp 982db6
      char_u	***file;
Karsten Hopp 982db6
      char	*dirnames[];
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      char_u	*s;
Karsten Hopp 982db6
      char_u	*e;
Karsten Hopp 982db6
+     char_u	*match;
Karsten Hopp 982db6
      garray_T	ga;
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
      int		pat_len;
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 5116,5148 ****
Karsten Hopp 982db6
  	    return FAIL;
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
  	sprintf((char *)s, "%s/%s*.vim", dirnames[i], pat);
Karsten Hopp 982db6
! 	matches = globpath(p_rtp, s, 0);
Karsten Hopp 982db6
  	vim_free(s);
Karsten Hopp 982db6
! 	if (matches == NULL)
Karsten Hopp 982db6
! 	    continue;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
! 	for (s = matches; *s != NUL; s = e)
Karsten Hopp 982db6
  	{
Karsten Hopp 982db6
! 	    e = vim_strchr(s, '\n');
Karsten Hopp 982db6
! 	    if (e == NULL)
Karsten Hopp 982db6
! 		e = s + STRLEN(s);
Karsten Hopp 982db6
! 	    if (ga_grow(&ga, 1) == FAIL)
Karsten Hopp 982db6
! 		break;
Karsten Hopp 982db6
! 	    if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
Karsten Hopp 982db6
! 	    {
Karsten Hopp 982db6
! 		for (s = e - 4; s > matches; mb_ptr_back(matches, s))
Karsten Hopp 982db6
! 		    if (*s == '\n' || vim_ispathsep(*s))
Karsten Hopp 982db6
! 			break;
Karsten Hopp 982db6
! 		++s;
Karsten Hopp 982db6
! 		((char_u **)ga.ga_data)[ga.ga_len] =
Karsten Hopp 982db6
! 					    vim_strnsave(s, (int)(e - s - 4));
Karsten Hopp 982db6
! 		++ga.ga_len;
Karsten Hopp 982db6
! 	    }
Karsten Hopp 982db6
! 	    if (*e != NUL)
Karsten Hopp 982db6
! 		++e;
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
- 	vim_free(matches);
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
      if (ga.ga_len == 0)
Karsten Hopp 982db6
  	return FAIL;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
--- 5116,5142 ----
Karsten Hopp 982db6
  	    return FAIL;
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
  	sprintf((char *)s, "%s/%s*.vim", dirnames[i], pat);
Karsten Hopp 982db6
! 	globpath(p_rtp, s, &ga, 0);
Karsten Hopp 982db6
  	vim_free(s);
Karsten Hopp 982db6
!     }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
!     for (i = 0; i < ga.ga_len; ++i)
Karsten Hopp 982db6
!     {
Karsten Hopp 982db6
! 	match = ((char_u **)ga.ga_data)[i];
Karsten Hopp 982db6
! 	s = match;
Karsten Hopp 982db6
! 	e = s + STRLEN(s);
Karsten Hopp 982db6
! 	if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
Karsten Hopp 982db6
  	{
Karsten Hopp 982db6
! 	    e -= 4;
Karsten Hopp 982db6
! 	    for (s = e; s > match; mb_ptr_back(match, s))
Karsten Hopp 982db6
! 		if (s < match || vim_ispathsep(*s))
Karsten Hopp 982db6
! 		    break;
Karsten Hopp 982db6
! 	    ++s;
Karsten Hopp 982db6
! 	    *e = NUL;
Karsten Hopp 982db6
! 	    mch_memmove(match, s, e - s + 1);
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
+ 
Karsten Hopp 982db6
      if (ga.ga_len == 0)
Karsten Hopp 982db6
  	return FAIL;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 5160,5192 ****
Karsten Hopp 982db6
  #if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
   * Expand "file" for all comma-separated directories in "path".
Karsten Hopp 982db6
!  * Returns an allocated string with all matches concatenated, separated by
Karsten Hopp 982db6
!  * newlines.  Returns NULL for an error or no matches.
Karsten Hopp 982db6
   */
Karsten Hopp 982db6
!     char_u *
Karsten Hopp 982db6
! globpath(path, file, expand_options)
Karsten Hopp 982db6
      char_u	*path;
Karsten Hopp 982db6
      char_u	*file;
Karsten Hopp 982db6
      int		expand_options;
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      expand_T	xpc;
Karsten Hopp 982db6
      char_u	*buf;
Karsten Hopp 982db6
-     garray_T	ga;
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
-     int		len;
Karsten Hopp 982db6
      int		num_p;
Karsten Hopp 982db6
      char_u	**p;
Karsten Hopp 982db6
-     char_u	*cur = NULL;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      buf = alloc(MAXPATHL);
Karsten Hopp 982db6
      if (buf == NULL)
Karsten Hopp 982db6
! 	return NULL;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      ExpandInit(&xpc);
Karsten Hopp 982db6
      xpc.xp_context = EXPAND_FILES;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
-     ga_init2(&ga, 1, 100);
Karsten Hopp 982db6
- 
Karsten Hopp 982db6
      /* Loop over all entries in {path}. */
Karsten Hopp 982db6
      while (*path != NUL)
Karsten Hopp 982db6
      {
Karsten Hopp 982db6
--- 5154,5181 ----
Karsten Hopp 982db6
  #if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO)
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
   * Expand "file" for all comma-separated directories in "path".
Karsten Hopp 982db6
!  * Adds the matches to "ga".  Caller must init "ga".
Karsten Hopp 982db6
   */
Karsten Hopp 982db6
!     void
Karsten Hopp 982db6
! globpath(path, file, ga, expand_options)
Karsten Hopp 982db6
      char_u	*path;
Karsten Hopp 982db6
      char_u	*file;
Karsten Hopp 982db6
+     garray_T	*ga;
Karsten Hopp 982db6
      int		expand_options;
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      expand_T	xpc;
Karsten Hopp 982db6
      char_u	*buf;
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
      int		num_p;
Karsten Hopp 982db6
      char_u	**p;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      buf = alloc(MAXPATHL);
Karsten Hopp 982db6
      if (buf == NULL)
Karsten Hopp 982db6
! 	return;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      ExpandInit(&xpc);
Karsten Hopp 982db6
      xpc.xp_context = EXPAND_FILES;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      /* Loop over all entries in {path}. */
Karsten Hopp 982db6
      while (*path != NUL)
Karsten Hopp 982db6
      {
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 5207,5236 ****
Karsten Hopp 982db6
  			     WILD_SILENT|expand_options) != FAIL && num_p > 0)
Karsten Hopp 982db6
  	    {
Karsten Hopp 982db6
  		ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
Karsten Hopp 982db6
- 		for (len = 0, i = 0; i < num_p; ++i)
Karsten Hopp 982db6
- 		    len += (int)STRLEN(p[i]) + 1;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
! 		/* Concatenate new results to previous ones. */
Karsten Hopp 982db6
! 		if (ga_grow(&ga, len) == OK)
Karsten Hopp 982db6
  		{
Karsten Hopp 982db6
- 		    cur = (char_u *)ga.ga_data + ga.ga_len;
Karsten Hopp 982db6
  		    for (i = 0; i < num_p; ++i)
Karsten Hopp 982db6
  		    {
Karsten Hopp 982db6
! 			STRCPY(cur, p[i]);
Karsten Hopp 982db6
! 			cur += STRLEN(p[i]);
Karsten Hopp 982db6
! 			*cur++ = '\n';
Karsten Hopp 982db6
  		    }
Karsten Hopp 982db6
- 		    ga.ga_len += len;
Karsten Hopp 982db6
  		}
Karsten Hopp 982db6
  		FreeWild(num_p, p);
Karsten Hopp 982db6
  	    }
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
-     if (cur != NULL)
Karsten Hopp 982db6
- 	*--cur = 0; /* Replace trailing newline with NUL */
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      vim_free(buf);
Karsten Hopp 982db6
-     return (char_u *)ga.ga_data;
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  #endif
Karsten Hopp 982db6
--- 5196,5218 ----
Karsten Hopp 982db6
  			     WILD_SILENT|expand_options) != FAIL && num_p > 0)
Karsten Hopp 982db6
  	    {
Karsten Hopp 982db6
  		ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
Karsten Hopp 982db6
  
Karsten Hopp 982db6
! 		if (ga_grow(ga, num_p) == OK)
Karsten Hopp 982db6
  		{
Karsten Hopp 982db6
  		    for (i = 0; i < num_p; ++i)
Karsten Hopp 982db6
  		    {
Karsten Hopp 982db6
! 			((char_u **)ga->ga_data)[ga->ga_len] =
Karsten Hopp 982db6
! 					    vim_strnsave(p[i], STRLEN(p[i]));
Karsten Hopp 982db6
! 			++ga->ga_len;
Karsten Hopp 982db6
  		    }
Karsten Hopp 982db6
  		}
Karsten Hopp 982db6
+ 
Karsten Hopp 982db6
  		FreeWild(num_p, p);
Karsten Hopp 982db6
  	    }
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      vim_free(buf);
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  #endif
Karsten Hopp 982db6
*** ../vim-7.4.278/src/misc1.c	2014-05-07 15:10:17.657108310 +0200
Karsten Hopp 982db6
--- src/misc1.c	2014-05-07 17:46:30.269190356 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 10336,10344 ****
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      char_u	*curdir;
Karsten Hopp 982db6
      garray_T	path_ga;
Karsten Hopp 982db6
-     char_u	*files = NULL;
Karsten Hopp 982db6
-     char_u	*s;	/* start */
Karsten Hopp 982db6
-     char_u	*e;	/* end */
Karsten Hopp 982db6
      char_u	*paths = NULL;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      if ((curdir = alloc((unsigned)MAXPATHL)) == NULL)
Karsten Hopp 982db6
--- 10336,10341 ----
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 10351,10387 ****
Karsten Hopp 982db6
      if (path_ga.ga_len == 0)
Karsten Hopp 982db6
  	return 0;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
!     paths = ga_concat_strings(&path_ga);
Karsten Hopp 982db6
      ga_clear_strings(&path_ga);
Karsten Hopp 982db6
      if (paths == NULL)
Karsten Hopp 982db6
  	return 0;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
!     files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
Karsten Hopp 982db6
      vim_free(paths);
Karsten Hopp 982db6
-     if (files == NULL)
Karsten Hopp 982db6
- 	return 0;
Karsten Hopp 982db6
- 
Karsten Hopp 982db6
-     /* Copy each path in files into gap */
Karsten Hopp 982db6
-     s = e = files;
Karsten Hopp 982db6
-     while (*s != NUL)
Karsten Hopp 982db6
-     {
Karsten Hopp 982db6
- 	while (*e != '\n' && *e != NUL)
Karsten Hopp 982db6
- 	    e++;
Karsten Hopp 982db6
- 	if (*e == NUL)
Karsten Hopp 982db6
- 	{
Karsten Hopp 982db6
- 	    addfile(gap, s, flags);
Karsten Hopp 982db6
- 	    break;
Karsten Hopp 982db6
- 	}
Karsten Hopp 982db6
- 	else
Karsten Hopp 982db6
- 	{
Karsten Hopp 982db6
- 	    /* *e is '\n' */
Karsten Hopp 982db6
- 	    *e = NUL;
Karsten Hopp 982db6
- 	    addfile(gap, s, flags);
Karsten Hopp 982db6
- 	    e++;
Karsten Hopp 982db6
- 	    s = e;
Karsten Hopp 982db6
- 	}
Karsten Hopp 982db6
-     }
Karsten Hopp 982db6
-     vim_free(files);
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      return gap->ga_len;
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
--- 10348,10360 ----
Karsten Hopp 982db6
      if (path_ga.ga_len == 0)
Karsten Hopp 982db6
  	return 0;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
!     paths = ga_concat_strings(&path_ga, ",");
Karsten Hopp 982db6
      ga_clear_strings(&path_ga);
Karsten Hopp 982db6
      if (paths == NULL)
Karsten Hopp 982db6
  	return 0;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
!     globpath(paths, pattern, gap, (flags & EW_ICASE) ? WILD_ICASE : 0);
Karsten Hopp 982db6
      vim_free(paths);
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      return gap->ga_len;
Karsten Hopp 982db6
  }
Karsten Hopp 982db6
*** ../vim-7.4.278/src/misc2.c	2014-03-23 15:12:29.927264336 +0100
Karsten Hopp 982db6
--- src/misc2.c	2014-05-07 18:34:37.689215632 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 2087,2115 ****
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
   * For a growing array that contains a list of strings: concatenate all the
Karsten Hopp 982db6
!  * strings with a separating comma.
Karsten Hopp 982db6
   * Returns NULL when out of memory.
Karsten Hopp 982db6
   */
Karsten Hopp 982db6
      char_u *
Karsten Hopp 982db6
! ga_concat_strings(gap)
Karsten Hopp 982db6
      garray_T *gap;
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
      int		len = 0;
Karsten Hopp 982db6
      char_u	*s;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      for (i = 0; i < gap->ga_len; ++i)
Karsten Hopp 982db6
! 	len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + 1;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      s = alloc(len + 1);
Karsten Hopp 982db6
      if (s != NULL)
Karsten Hopp 982db6
      {
Karsten Hopp 982db6
  	*s = NUL;
Karsten Hopp 982db6
  	for (i = 0; i < gap->ga_len; ++i)
Karsten Hopp 982db6
  	{
Karsten Hopp 982db6
! 	    if (*s != NUL)
Karsten Hopp 982db6
! 		STRCAT(s, ",");
Karsten Hopp 982db6
! 	    STRCAT(s, ((char_u **)(gap->ga_data))[i]);
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
      return s;
Karsten Hopp 982db6
--- 2087,2123 ----
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  /*
Karsten Hopp 982db6
   * For a growing array that contains a list of strings: concatenate all the
Karsten Hopp 982db6
!  * strings with a separating "sep".
Karsten Hopp 982db6
   * Returns NULL when out of memory.
Karsten Hopp 982db6
   */
Karsten Hopp 982db6
      char_u *
Karsten Hopp 982db6
! ga_concat_strings(gap, sep)
Karsten Hopp 982db6
      garray_T *gap;
Karsten Hopp 982db6
+     char     *sep;
Karsten Hopp 982db6
  {
Karsten Hopp 982db6
      int		i;
Karsten Hopp 982db6
      int		len = 0;
Karsten Hopp 982db6
+     int		sep_len = (int)STRLEN(sep);
Karsten Hopp 982db6
      char_u	*s;
Karsten Hopp 982db6
+     char_u	*p;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      for (i = 0; i < gap->ga_len; ++i)
Karsten Hopp 982db6
! 	len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + sep_len;
Karsten Hopp 982db6
  
Karsten Hopp 982db6
      s = alloc(len + 1);
Karsten Hopp 982db6
      if (s != NULL)
Karsten Hopp 982db6
      {
Karsten Hopp 982db6
  	*s = NUL;
Karsten Hopp 982db6
+ 	p = s;
Karsten Hopp 982db6
  	for (i = 0; i < gap->ga_len; ++i)
Karsten Hopp 982db6
  	{
Karsten Hopp 982db6
! 	    if (p != s)
Karsten Hopp 982db6
! 	    {
Karsten Hopp 982db6
! 		STRCPY(p, sep);
Karsten Hopp 982db6
! 		p += sep_len;
Karsten Hopp 982db6
! 	    }
Karsten Hopp 982db6
! 	    STRCPY(p, ((char_u **)(gap->ga_data))[i]);
Karsten Hopp 982db6
! 	    p += STRLEN(p);
Karsten Hopp 982db6
  	}
Karsten Hopp 982db6
      }
Karsten Hopp 982db6
      return s;
Karsten Hopp 982db6
*** ../vim-7.4.278/src/proto/ex_getln.pro	2013-08-10 13:37:11.000000000 +0200
Karsten Hopp 982db6
--- src/proto/ex_getln.pro	2014-05-07 17:52:42.457193614 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 32,38 ****
Karsten Hopp 982db6
  void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
Karsten Hopp 982db6
  int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
Karsten Hopp 982db6
  int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)), int escaped));
Karsten Hopp 982db6
! char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
Karsten Hopp 982db6
  void init_history __ARGS((void));
Karsten Hopp 982db6
  int get_histtype __ARGS((char_u *name));
Karsten Hopp 982db6
  void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
Karsten Hopp 982db6
--- 32,38 ----
Karsten Hopp 982db6
  void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
Karsten Hopp 982db6
  int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
Karsten Hopp 982db6
  int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)), int escaped));
Karsten Hopp 982db6
! void globpath __ARGS((char_u *path, char_u *file, garray_T *ga, int expand_options));
Karsten Hopp 982db6
  void init_history __ARGS((void));
Karsten Hopp 982db6
  int get_histtype __ARGS((char_u *name));
Karsten Hopp 982db6
  void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
Karsten Hopp 982db6
*** ../vim-7.4.278/src/proto/misc2.pro	2014-02-23 23:38:58.828760280 +0100
Karsten Hopp 982db6
--- src/proto/misc2.pro	2014-05-07 17:52:36.189193559 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 55,61 ****
Karsten Hopp 982db6
  void ga_init __ARGS((garray_T *gap));
Karsten Hopp 982db6
  void ga_init2 __ARGS((garray_T *gap, int itemsize, int growsize));
Karsten Hopp 982db6
  int ga_grow __ARGS((garray_T *gap, int n));
Karsten Hopp 982db6
! char_u *ga_concat_strings __ARGS((garray_T *gap));
Karsten Hopp 982db6
  void ga_concat __ARGS((garray_T *gap, char_u *s));
Karsten Hopp 982db6
  void ga_append __ARGS((garray_T *gap, int c));
Karsten Hopp 982db6
  void append_ga_line __ARGS((garray_T *gap));
Karsten Hopp 982db6
--- 55,61 ----
Karsten Hopp 982db6
  void ga_init __ARGS((garray_T *gap));
Karsten Hopp 982db6
  void ga_init2 __ARGS((garray_T *gap, int itemsize, int growsize));
Karsten Hopp 982db6
  int ga_grow __ARGS((garray_T *gap, int n));
Karsten Hopp 982db6
! char_u *ga_concat_strings __ARGS((garray_T *gap, char *sep));
Karsten Hopp 982db6
  void ga_concat __ARGS((garray_T *gap, char_u *s));
Karsten Hopp 982db6
  void ga_append __ARGS((garray_T *gap, int c));
Karsten Hopp 982db6
  void append_ga_line __ARGS((garray_T *gap));
Karsten Hopp 982db6
*** ../vim-7.4.278/src/testdir/test97.in	2013-08-02 14:55:50.000000000 +0200
Karsten Hopp 982db6
--- src/testdir/test97.in	2014-05-07 18:27:59.213212144 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 5,16 ****
Karsten Hopp 982db6
  :so small.vim
Karsten Hopp 982db6
  :set shell=doesnotexist
Karsten Hopp 982db6
  :e test.out
Karsten Hopp 982db6
! :put =glob('Xxx\{')
Karsten Hopp 982db6
! :put =glob('Xxx\$')
Karsten Hopp 982db6
  :w! Xxx{
Karsten Hopp 982db6
  :w! Xxx\$
Karsten Hopp 982db6
! :put =glob('Xxx\{')
Karsten Hopp 982db6
! :put =glob('Xxx\$')
Karsten Hopp 982db6
  :w
Karsten Hopp 982db6
  :qa!
Karsten Hopp 982db6
  ENDTEST
Karsten Hopp 982db6
--- 5,19 ----
Karsten Hopp 982db6
  :so small.vim
Karsten Hopp 982db6
  :set shell=doesnotexist
Karsten Hopp 982db6
  :e test.out
Karsten Hopp 982db6
! :$put =glob('Xxx\{')
Karsten Hopp 982db6
! :$put =glob('Xxx\$')
Karsten Hopp 982db6
  :w! Xxx{
Karsten Hopp 982db6
  :w! Xxx\$
Karsten Hopp 982db6
! :$put =glob('Xxx\{')
Karsten Hopp 982db6
! :$put =glob('Xxx\$')
Karsten Hopp 982db6
! :"
Karsten Hopp 982db6
! :$put =string(globpath('sautest/autoload', '*.vim'))
Karsten Hopp 982db6
! :$put =string(globpath('sautest/autoload', '*.vim', 0, 1))
Karsten Hopp 982db6
  :w
Karsten Hopp 982db6
  :qa!
Karsten Hopp 982db6
  ENDTEST
Karsten Hopp 982db6
*** ../vim-7.4.278/src/testdir/test97.ok	2013-07-03 16:14:50.000000000 +0200
Karsten Hopp 982db6
--- src/testdir/test97.ok	2014-05-07 18:28:01.985212168 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 3,5 ****
Karsten Hopp 982db6
--- 3,8 ----
Karsten Hopp 982db6
  
Karsten Hopp 982db6
  Xxx{
Karsten Hopp 982db6
  Xxx$
Karsten Hopp 982db6
+ 'sautest/autoload/Test104.vim
Karsten Hopp 982db6
+ sautest/autoload/footest.vim'
Karsten Hopp 982db6
+ ['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim']
Karsten Hopp 982db6
*** ../vim-7.4.278/src/version.c	2014-05-07 17:31:32.473182497 +0200
Karsten Hopp 982db6
--- src/version.c	2014-05-07 17:35:06.253184368 +0200
Karsten Hopp 982db6
***************
Karsten Hopp 982db6
*** 736,737 ****
Karsten Hopp 982db6
--- 736,739 ----
Karsten Hopp 982db6
  {   /* Add new patch number below this line */
Karsten Hopp 982db6
+ /**/
Karsten Hopp 982db6
+     279,
Karsten Hopp 982db6
  /**/
Karsten Hopp 982db6
Karsten Hopp 982db6
-- 
Karsten Hopp 982db6
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 982db6
121. You ask for e-mail adresses instead of telephone numbers.
Karsten Hopp 982db6
Karsten Hopp 982db6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 982db6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 982db6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 982db6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///