From cb3ae73c2f54054edeb736140555f1475c18e2ec Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Thu, 18 Jan 2018 18:39:02 +0100 Subject: [PATCH] stream: remove unreachable code To avoid a function call `BufferList.prototype.concat()` is not called when there is only a buffer in the list. That buffer is instead accessed directly. PR-URL: https://github.com/nodejs/node/pull/18239 Reviewed-By: Matteo Collina --- lib/internal/streams/BufferList.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/streams/BufferList.js b/lib/internal/streams/BufferList.js index c5a293b9ca0c16..b3980e007a499e 100644 --- a/lib/internal/streams/BufferList.js +++ b/lib/internal/streams/BufferList.js @@ -62,8 +62,6 @@ module.exports = class BufferList { concat(n) { if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) - return this.head.data; const ret = Buffer.allocUnsafe(n >>> 0); var p = this.head; var i = 0;