From 968121bbfe83c493f1ed709003746a195f805479 Mon Sep 17 00:00:00 2001 From: Brian White Date: Mon, 21 Aug 2017 03:31:24 -0400 Subject: [PATCH] src: remove unnecessary helper function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ever since e2fcfea46e, `OnReadCommon()` is no longer shared between more than one function. PR-URL: https://github.com/nodejs/node/pull/14959 Reviewed-By: Michaël Zasso Reviewed-By: Daniel Bevenius Reviewed-By: Anna Henningsen Reviewed-By: Tobias Nießen Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/stream_wrap.cc | 30 ++++++++++-------------------- src/stream_wrap.h | 4 ---- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index d294b641ffa444..7709e24a6b4d93 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -222,13 +222,18 @@ void StreamWrap::OnReadImpl(ssize_t nread, } -void StreamWrap::OnReadCommon(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf, - uv_handle_type pending) { +void StreamWrap::OnRead(uv_stream_t* handle, + ssize_t nread, + const uv_buf_t* buf) { StreamWrap* wrap = static_cast(handle->data); HandleScope scope(wrap->env()->isolate()); Context::Scope context_scope(wrap->env()->context()); + uv_handle_type type = UV_UNKNOWN_HANDLE; + + if (wrap->is_named_pipe_ipc() && + uv_pipe_pending_count(reinterpret_cast(handle)) > 0) { + type = uv_pipe_pending_type(reinterpret_cast(handle)); + } // We should not be getting this callback if someone as already called // uv_close() on the handle. @@ -242,22 +247,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle, } } - static_cast(wrap)->OnRead(nread, buf, pending); -} - - -void StreamWrap::OnRead(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf) { - StreamWrap* wrap = static_cast(handle->data); - uv_handle_type type = UV_UNKNOWN_HANDLE; - - if (wrap->is_named_pipe_ipc() && - uv_pipe_pending_count(reinterpret_cast(handle)) > 0) { - type = uv_pipe_pending_type(reinterpret_cast(handle)); - } - - OnReadCommon(handle, nread, buf, type); + static_cast(wrap)->OnRead(nread, buf, type); } diff --git a/src/stream_wrap.h b/src/stream_wrap.h index e930670202d2d8..3b2ce8ee3beb00 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -84,10 +84,6 @@ class StreamWrap : public HandleWrap, public StreamBase { static void OnRead(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf); - static void OnReadCommon(uv_stream_t* handle, - ssize_t nread, - const uv_buf_t* buf, - uv_handle_type pending); static void AfterWrite(uv_write_t* req, int status); static void AfterShutdown(uv_shutdown_t* req, int status);