From 9a8db3c0cb97520ffec57c42d60f1f329ecc9471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 21 Feb 2013 10:01:27 +0100 Subject: [PATCH] unix: reduce line count, return uv__set_sys_error --- src/unix/stream.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index 30199f17..4ce32407 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1193,16 +1193,12 @@ int uv_write2(uv_write_t* req, stream->type == UV_TTY) && "uv_write (unix) does not yet support other types of streams"); - if (uv__stream_fd(stream) < 0) { - uv__set_sys_error(stream->loop, EBADF); - return -1; - } + if (uv__stream_fd(stream) < 0) + return uv__set_sys_error(stream->loop, EBADF); if (send_handle) { - if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) { - uv__set_sys_error(stream->loop, EOPNOTSUPP); - return -1; - } + if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) + return uv__set_sys_error(stream->loop, EOPNOTSUPP); if (uv__stream_fd(send_handle) < 0) return uv__set_sys_error(stream->loop, EBADF); } @@ -1270,10 +1266,8 @@ static int uv__read_start_common(uv_stream_t* stream, assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || stream->type == UV_TTY); - if (stream->flags & UV_CLOSING) { - uv__set_sys_error(stream->loop, EINVAL); - return -1; - } + if (stream->flags & UV_CLOSING) + return uv__set_sys_error(stream->loop, EINVAL); /* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just * expresses the desired state of the user.