diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2015-05-03 09:25:53 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2015-05-29 13:12:12 -0400 |
commit | 412d246be71bd99cb4edde4e6f984b0b0d91bcd9 (patch) | |
tree | 01307051583b9cf2faf56778a9bd88e00d2a2122 /src/nvim/ex_cmds.c | |
parent | fa0f1222212704c93ab828b876bda5e9e1cb507e (diff) | |
download | rneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.tar.gz rneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.tar.bz2 rneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.zip |
getenv: return NULL if empty #2574
Making an environment variable empty can be a way of unsetting it for
platforms that don't support unsetenv(). In most cases, we treat empty
variables as having been unset. For all others, use os_env_exists().
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 824cc125f4..b4adef9235 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1658,9 +1658,9 @@ static char_u *viminfo_filename(char_u *file) file = use_viminfo; else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL) { #ifdef VIMINFO_FILE2 - /* don't use $HOME when not defined (turned into "c:/"!). */ - if (os_getenv((char_u *)"HOME") == NULL) { - /* don't use $VIM when not available. */ + // don't use $HOME when not defined (turned into "c:/"!). + if (!os_env_exists("HOME")) { + // don't use $VIM when not available. expand_env((char_u *)"$VIM", NameBuff, MAXPATHL); if (STRCMP("$VIM", NameBuff) != 0) /* $VIM was expanded */ file = (char_u *)VIMINFO_FILE2; |