From 53e0f632dbed27f0889322bcf0244c886c549835 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Fri, 12 Apr 2019 18:32:19 +0200 Subject: [PATCH] stream: inline onwriteStateUpdate() The function is very simple and is only called from `onwrite()`. PR-URL: https://github.com/nodejs/node/pull/27203 Reviewed-By: Ruben Bridgewater Reviewed-By: Masashi Hirano Reviewed-By: Colin Ihrig Reviewed-By: Yongsheng Zhang --- lib/_stream_writable.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 9d06adc775d240..83fd6d1f4d4697 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -442,13 +442,6 @@ function onwriteError(stream, state, sync, er, cb) { } } -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - function onwrite(stream, er) { const state = stream._writableState; const sync = state.sync; @@ -457,7 +450,10 @@ function onwrite(stream, er) { if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; if (er) onwriteError(stream, state, sync, er, cb);