aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/env.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-27 07:33:29 +0800
committerGitHub <noreply@github.com>2022-08-27 07:33:29 +0800
commit58b29e344c639e47fd916129d2195883537357b6 (patch)
tree2a6d4599e7549786d624756ac8d6e4cfd46fce83 /src/nvim/os/env.c
parentd5e08837128530f05b2fc8900e826f767e4961ee (diff)
parent608134794d2a039358825396b860a7f432c1a4bd (diff)
downloadrneovim-58b29e344c639e47fd916129d2195883537357b6.tar.gz
rneovim-58b29e344c639e47fd916129d2195883537357b6.tar.bz2
rneovim-58b29e344c639e47fd916129d2195883537357b6.zip
Merge pull request #19962 from zeertzjq/vim-9.0.0278
vim-patch:9.0.{0278,0279,0283,0284}: cmdline completion patches
Diffstat (limited to 'src/nvim/os/env.c')
-rw-r--r--src/nvim/os/env.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index d46d51882e..ea9a803a86 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -1156,15 +1156,12 @@ char *home_replace_save(buf_T *buf, const char *src)
/// Function given to ExpandGeneric() to obtain an environment variable name.
char *get_env_name(expand_T *xp, int idx)
{
-#define ENVNAMELEN 100
- // this static buffer is needed to avoid a memory leak in ExpandGeneric
- static char_u name[ENVNAMELEN];
assert(idx >= 0);
char *envname = os_getenvname_at_index((size_t)idx);
if (envname) {
- STRLCPY(name, envname, ENVNAMELEN);
+ STRLCPY(xp->xp_buf, envname, EXPAND_BUF_LEN);
xfree(envname);
- return (char *)name;
+ return xp->xp_buf;
}
return NULL;
}