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/msgpack_rpc/server.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/msgpack_rpc/server.c')
-rw-r--r-- | src/nvim/msgpack_rpc/server.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index ab1b04d73f..388b5a04cf 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -16,6 +16,7 @@ #include "nvim/log.h" #include "nvim/tempfile.h" #include "nvim/path.h" +#include "nvim/strings.h" #define MAX_CONNECTIONS 32 #define ADDRESS_MAX_SIZE 256 @@ -59,7 +60,7 @@ bool server_init(void) bool must_free = false; const char *listen_address = os_getenv(LISTEN_ADDRESS_ENV_VAR); - if (listen_address == NULL || *listen_address == NUL) { + if (listen_address == NULL) { must_free = true; listen_address = (char *)vim_tempname(); } @@ -216,7 +217,7 @@ int server_start(const char *endpoint) // Update $NVIM_LISTEN_ADDRESS, if not set. const char *listen_address = os_getenv(LISTEN_ADDRESS_ENV_VAR); - if (listen_address == NULL || *listen_address == NUL) { + if (listen_address == NULL) { os_setenv(LISTEN_ADDRESS_ENV_VAR, addr, 1); } |