diff options
author | Сковорода Никита Андреевич <chalkerx@gmail.com> | 2016-09-23 23:55:53 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-10-06 15:27:52 -0700 |
commit | 0f944ab3cf4435c299471e90515742eb99bac15e (patch) | |
tree | 0720e5f34bcb03404c570137a045d6ad950bb0e5 /lib | |
parent | b88612d15e8a0a0daad22c160a324cdfcdfe76e4 (diff) | |
download | android-node-v8-0f944ab3cf4435c299471e90515742eb99bac15e.tar.gz android-node-v8-0f944ab3cf4435c299471e90515742eb99bac15e.tar.bz2 android-node-v8-0f944ab3cf4435c299471e90515742eb99bac15e.zip |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dgram.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index 3a54c3c7f1..39d43092e1 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -350,7 +350,7 @@ Socket.prototype.send = function(buffer, self.bind({port: 0, exclusive: true}, null); if (list.length === 0) - list.push(Buffer.allocUnsafe(0)); + list.push(Buffer.alloc(0)); // If the socket hasn't been bound yet, push the outbound packet onto the // send queue and send after binding is complete. |