Skip to content

Commit

Permalink
stream: remove unreachable code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lpinca authored and MylesBorins committed Mar 30, 2018
1 parent 1d88266 commit 37e594e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/internal/streams/BufferList.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,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;
Expand Down

0 comments on commit 37e594e

Please sign in to comment.