Skip to content

Commit 53e0f63

Browse files
lpincadanbev
authored andcommitted
stream: inline onwriteStateUpdate()
The function is very simple and is only called from `onwrite()`. PR-URL: #27203 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]>
1 parent de463f1 commit 53e0f63

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/_stream_writable.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,6 @@ function onwriteError(stream, state, sync, er, cb) {
442442
}
443443
}
444444

445-
function onwriteStateUpdate(state) {
446-
state.writing = false;
447-
state.writecb = null;
448-
state.length -= state.writelen;
449-
state.writelen = 0;
450-
}
451-
452445
function onwrite(stream, er) {
453446
const state = stream._writableState;
454447
const sync = state.sync;
@@ -457,7 +450,10 @@ function onwrite(stream, er) {
457450
if (typeof cb !== 'function')
458451
throw new ERR_MULTIPLE_CALLBACK();
459452

460-
onwriteStateUpdate(state);
453+
state.writing = false;
454+
state.writecb = null;
455+
state.length -= state.writelen;
456+
state.writelen = 0;
461457

462458
if (er)
463459
onwriteError(stream, state, sync, er, cb);

0 commit comments

Comments
 (0)