Skip to content

Commit 968121b

Browse files
mscdexMylesBorins
authored andcommitted
src: remove unnecessary helper function
Ever since e2fcfea, `OnReadCommon()` is no longer shared between more than one function. PR-URL: #14959 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 70e9a6e commit 968121b

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

src/stream_wrap.cc

+10-20
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,18 @@ void StreamWrap::OnReadImpl(ssize_t nread,
222222
}
223223

224224

225-
void StreamWrap::OnReadCommon(uv_stream_t* handle,
226-
ssize_t nread,
227-
const uv_buf_t* buf,
228-
uv_handle_type pending) {
225+
void StreamWrap::OnRead(uv_stream_t* handle,
226+
ssize_t nread,
227+
const uv_buf_t* buf) {
229228
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
230229
HandleScope scope(wrap->env()->isolate());
231230
Context::Scope context_scope(wrap->env()->context());
231+
uv_handle_type type = UV_UNKNOWN_HANDLE;
232+
233+
if (wrap->is_named_pipe_ipc() &&
234+
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
235+
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
236+
}
232237

233238
// We should not be getting this callback if someone as already called
234239
// uv_close() on the handle.
@@ -242,22 +247,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
242247
}
243248
}
244249

245-
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, pending);
246-
}
247-
248-
249-
void StreamWrap::OnRead(uv_stream_t* handle,
250-
ssize_t nread,
251-
const uv_buf_t* buf) {
252-
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
253-
uv_handle_type type = UV_UNKNOWN_HANDLE;
254-
255-
if (wrap->is_named_pipe_ipc() &&
256-
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
257-
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
258-
}
259-
260-
OnReadCommon(handle, nread, buf, type);
250+
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, type);
261251
}
262252

263253

src/stream_wrap.h

-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ class StreamWrap : public HandleWrap, public StreamBase {
8484
static void OnRead(uv_stream_t* handle,
8585
ssize_t nread,
8686
const uv_buf_t* buf);
87-
static void OnReadCommon(uv_stream_t* handle,
88-
ssize_t nread,
89-
const uv_buf_t* buf,
90-
uv_handle_type pending);
9187
static void AfterWrite(uv_write_t* req, int status);
9288
static void AfterShutdown(uv_shutdown_t* req, int status);
9389

0 commit comments

Comments
 (0)