Skip to content

Commit 37e594e

Browse files
lpincaMylesBorins
authored andcommitted
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: #18239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 1d88266 commit 37e594e

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

lib/internal/streams/BufferList.js

-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ module.exports = class BufferList {
6161
concat(n) {
6262
if (this.length === 0)
6363
return Buffer.alloc(0);
64-
if (this.length === 1)
65-
return this.head.data;
6664
const ret = Buffer.allocUnsafe(n >>> 0);
6765
var p = this.head;
6866
var i = 0;

0 commit comments

Comments
 (0)