Skip to content

Commit abc5cdc

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 87c3e1d commit abc5cdc

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
@@ -242,13 +242,18 @@ void StreamWrap::OnReadImpl(ssize_t nread,
242242
}
243243

244244

245-
void StreamWrap::OnReadCommon(uv_stream_t* handle,
246-
ssize_t nread,
247-
const uv_buf_t* buf,
248-
uv_handle_type pending) {
245+
void StreamWrap::OnRead(uv_stream_t* handle,
246+
ssize_t nread,
247+
const uv_buf_t* buf) {
249248
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
250249
HandleScope scope(wrap->env()->isolate());
251250
Context::Scope context_scope(wrap->env()->context());
251+
uv_handle_type type = UV_UNKNOWN_HANDLE;
252+
253+
if (wrap->is_named_pipe_ipc() &&
254+
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
255+
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
256+
}
252257

253258
// We should not be getting this callback if someone as already called
254259
// uv_close() on the handle.
@@ -262,22 +267,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle,
262267
}
263268
}
264269

265-
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, pending);
266-
}
267-
268-
269-
void StreamWrap::OnRead(uv_stream_t* handle,
270-
ssize_t nread,
271-
const uv_buf_t* buf) {
272-
StreamWrap* wrap = static_cast<StreamWrap*>(handle->data);
273-
uv_handle_type type = UV_UNKNOWN_HANDLE;
274-
275-
if (wrap->is_named_pipe_ipc() &&
276-
uv_pipe_pending_count(reinterpret_cast<uv_pipe_t*>(handle)) > 0) {
277-
type = uv_pipe_pending_type(reinterpret_cast<uv_pipe_t*>(handle));
278-
}
279-
280-
OnReadCommon(handle, nread, buf, type);
270+
static_cast<StreamBase*>(wrap)->OnRead(nread, buf, type);
281271
}
282272

283273

src/stream_wrap.h

-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ class StreamWrap : public HandleWrap, public StreamBase {
104104
static void OnRead(uv_stream_t* handle,
105105
ssize_t nread,
106106
const uv_buf_t* buf);
107-
static void OnReadCommon(uv_stream_t* handle,
108-
ssize_t nread,
109-
const uv_buf_t* buf,
110-
uv_handle_type pending);
111107
static void AfterWrite(uv_write_t* req, int status);
112108
static void AfterShutdown(uv_shutdown_t* req, int status);
113109

0 commit comments

Comments
 (0)