From 18d58643af8fdc6d366171550bb45029058c3488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Sat, 27 Sep 2014 00:43:09 +0200 Subject: [PATCH] cleanup: remove all dead assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As pointed out by clang-analyzer. PR-URL: https://github.com/libuv/libuv/pull/13 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé --- src/unix/pipe.c | 13 +++---------- src/unix/stream.c | 1 - src/unix/udp.c | 3 --- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/unix/pipe.c b/src/unix/pipe.c index a26c3dbc..b20fb921 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -44,13 +44,10 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { struct sockaddr_un saddr; const char* pipe_fname; int sockfd; - int bound; int err; pipe_fname = NULL; sockfd = -1; - bound = 0; - err = -EINVAL; /* Already bound? */ if (uv__stream_fd(handle) >= 0) @@ -83,7 +80,6 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { err = -EACCES; goto out; } - bound = 1; /* Success. */ handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */ @@ -91,11 +87,9 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) { return 0; out: - if (bound) { - /* unlink() before uv__close() to avoid races. */ - assert(pipe_fname != NULL); - unlink(pipe_fname); - } + /* unlink() before uv__close() to avoid races. */ + assert(pipe_fname != NULL); + unlink(pipe_fname); uv__close(sockfd); free((void*)pipe_fname); return err; @@ -158,7 +152,6 @@ void uv_pipe_connect(uv_connect_t* req, int r; new_sock = (uv__stream_fd(handle) == -1); - err = -EINVAL; if (new_sock) { err = uv__socket(AF_UNIX, SOCK_STREAM, 0); diff --git a/src/unix/stream.c b/src/unix/stream.c index 757b4080..d41a3429 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -549,7 +549,6 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) { if (server->accepted_fd == -1) return -EAGAIN; - err = 0; switch (client->type) { case UV_NAMED_PIPE: case UV_TCP: diff --git a/src/unix/udp.c b/src/unix/udp.c index 7cafea1d..71a0e41f 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -278,9 +278,6 @@ int uv__udp_bind(uv_udp_t* handle, int yes; int fd; - err = -EINVAL; - fd = -1; - /* Check for bad flags. */ if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR)) return -EINVAL;