Browse Source

src: remove unnecessary helper function

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 <targos@protonmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
canary-base
Brian White 8 years ago
committed by James M Snell
parent
commit
8935239319
  1. 30
      src/stream_wrap.cc
  2. 4
      src/stream_wrap.h

30
src/stream_wrap.cc

@ -242,13 +242,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<StreamWrap*>(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<uv_pipe_t*>(handle)) > 0) {
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
}
// We should not be getting this callback if someone as already called
// uv_close() on the handle.
@ -262,22 +267,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
}
}
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, pending);
}
void StreamWrap::OnRead(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf) {
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
uv_handle_type type = UV_UNKNOWN_HANDLE;
if (wrap->is_named_pipe_ipc() &&
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
}
OnReadCommon(handle, nread, buf, type);
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, type);
}

4
src/stream_wrap.h

@ -104,10 +104,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);

Loading…
Cancel
Save