Skip to content

Commit dda45c4

Browse files
ChALkeRjasnell
authored andcommitted
dgram: use Buffer.alloc(0) for zero-size buffers
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 74c772c commit dda45c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/dgram.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Socket.prototype.send = function(buffer,
350350
self.bind({port: 0, exclusive: true}, null);
351351

352352
if (list.length === 0)
353-
list.push(Buffer.allocUnsafe(0));
353+
list.push(Buffer.alloc(0));
354354

355355
// If the socket hasn't been bound yet, push the outbound packet onto the
356356
// send queue and send after binding is complete.

0 commit comments

Comments
 (0)