mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
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().
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user