-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dgram: use Buffer.alloc(0) for zero-size buffers #8751
Conversation
There is no difference between alloc(0) and allocUnsafe(0), so there is no reason to confuse anyone reading the code with an additional call to allocUnsafe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
There is no difference between alloc(0) and allocUnsafe(0), so there is no reason to confuse anyone reading the code with an additional call to allocUnsafe. PR-URL: #8751 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 0f944ab. Thank you! |
lts? |
Yes, pulling this back makes sense. |
There is no difference between alloc(0) and allocUnsafe(0), so there is no reason to confuse anyone reading the code with an additional call to allocUnsafe. PR-URL: #8751 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
There is no difference between alloc(0) and allocUnsafe(0), so there is no reason to confuse anyone reading the code with an additional call to allocUnsafe. PR-URL: #8751 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
@ChALkeR this is not landing cleanly on v4.x, would you be willing to manually backport? |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
dgram
Description of change
There is no difference between
Buffer.alloc(0)
andBuffer.allocUnsafe(0)
, so there is no reason to confuse anyone reading the code with an additional call toallocUnsafe
./cc @jasnell @addaleax
Upd: ow, I created a branch on this repo, will delete it after this merges.