forked from aniani/vim
patch 9.0.0284: using static buffer for multiple completion functions
Problem: Using static buffer for multiple completion functions. Solution: Use one buffer in expand_T.
This commit is contained in:
20
src/misc1.c
20
src/misc1.c
@@ -2016,18 +2016,14 @@ get_env_name(
|
||||
expand_T *xp UNUSED,
|
||||
int idx)
|
||||
{
|
||||
# if defined(AMIGA)
|
||||
/*
|
||||
* No environ[] on the Amiga.
|
||||
*/
|
||||
#if defined(AMIGA)
|
||||
// No environ[] on the Amiga.
|
||||
return NULL;
|
||||
# else
|
||||
#else
|
||||
# ifndef __WIN32__
|
||||
// Borland C++ 5.2 has this in a header file.
|
||||
extern char **environ;
|
||||
# endif
|
||||
# define ENVNAMELEN 100
|
||||
static char_u name[ENVNAMELEN];
|
||||
char_u *str;
|
||||
int n;
|
||||
|
||||
@@ -2035,15 +2031,15 @@ get_env_name(
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
for (n = 0; n < ENVNAMELEN - 1; ++n)
|
||||
for (n = 0; n < EXPAND_BUF_LEN - 1; ++n)
|
||||
{
|
||||
if (str[n] == '=' || str[n] == NUL)
|
||||
break;
|
||||
name[n] = str[n];
|
||||
xp->xp_buf[n] = str[n];
|
||||
}
|
||||
name[n] = NUL;
|
||||
return name;
|
||||
# endif
|
||||
xp->xp_buf[n] = NUL;
|
||||
return xp->xp_buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user