Skip to content

Commit 8f830ca

Browse files
lpincaMylesBorins
authored andcommittedMar 30, 2018
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. Backport-PR-URL: #19483 PR-URL: #18239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 49d8c2e commit 8f830ca

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
@@ -58,8 +58,6 @@ BufferList.prototype.join = function(s) {
5858
BufferList.prototype.concat = function(n) {
5959
if (this.length === 0)
6060
return Buffer.alloc(0);
61-
if (this.length === 1)
62-
return this.head.data;
6361
const ret = Buffer.allocUnsafe(n >>> 0);
6462
var p = this.head;
6563
var i = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.