From 507bda1c95cdac2886f64e59aa6bbf85c3fac389 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 8 Apr 2018 17:20:25 +0200 Subject: server: introduce --listen, deprecate $NVIM_LISTEN_ADDRESS --- src/nvim/msgpack_rpc/server.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/nvim/msgpack_rpc') diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index 4d0e6b07a0..abff5cfe4f 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -32,24 +32,26 @@ static garray_T watchers = GA_EMPTY_INIT_VALUE; #endif /// Initializes the module -bool server_init(void) +bool server_init(const char *listen_address) { ga_init(&watchers, sizeof(SocketWatcher *), 1); bool must_free = false; - const char *listen_address = os_getenv(LISTEN_ADDRESS_ENV_VAR); if (listen_address == NULL) { - must_free = true; - listen_address = server_address_new(); - } - - if (!listen_address) { - return false; + // Deprecated: $NVIM_LISTEN_ADDRESS + listen_address = os_getenv(LISTEN_ADDRESS_ENV_VAR); + if (listen_address == NULL) { + must_free = true; + listen_address = server_address_new(); + if (listen_address == NULL) { + return false; + } + } } bool ok = (server_start(listen_address) == 0); if (must_free) { - xfree((char *) listen_address); + xfree((char *)listen_address); } return ok; } -- cgit