{{ message }}
stream: remove unreachable code #18239
Closed
lpinca wants to merge 2 commits into
Closed
Conversation
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.
The `n` argument of `BufferList.prototype.concat()` is not the number of `Buffer` instances in the list, but their total length when concatenated.
Member
Member
Author
Member
|
ok. I agree. |
Member
|
/cc @nodejs/streams |
Member
|
I'm not super comfortable with this change. |
Member
Author
Do you mean if |
Member
|
Can you restore the test then? |
lpinca
commented
Jan 20, 2018
|
|
||
| const copy = list.concat(3); | ||
|
|
||
| assert.strictEqual(list.concat(1), 'foo'); |
Member
Author
There was a problem hiding this comment.
@mcollina this is wrong whether or not the change in BufferList.js is applied.
- The test uses a string, probably for simplicity, but
concat()only works with buffers. - The
nargument (1) was wrong and irrelevant. You could have used any argument and the test would have still passed.
Member
Author
|
FWIW the fixed test actually tests the impossible case where |
Member
Author
lpinca
added a commit
that referenced
this pull request
Jan 24, 2018
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>
lpinca
added a commit
that referenced
this pull request
Jan 24, 2018
The `n` argument of `BufferList.prototype.concat()` is not the number of `Buffer` instances in the list, but their total length when concatenated. PR-URL: #18239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Member
Author
evanlucas
pushed a commit
that referenced
this pull request
Jan 30, 2018
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>
evanlucas
pushed a commit
that referenced
this pull request
Jan 30, 2018
The `n` argument of `BufferList.prototype.concat()` is not the number of `Buffer` instances in the list, but their total length when concatenated. PR-URL: #18239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This was referenced Apr 7, 2024
This was referenced Apr 7, 2024
This was referenced Apr 7, 2024
This was referenced Apr 7, 2024
This was referenced Oct 21, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

First commit remove some unreachable code.
BufferList.prototype.concat()is not called when there is only a buffer in the list.Second commit fixes a test.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
stream, test