From 412d246be71bd99cb4edde4e6f984b0b0d91bcd9 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sun, 3 May 2015 09:25:53 -0400 Subject: 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(). --- src/nvim/ex_cmds.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds.c') 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; -- cgit