From c4d9b54f75dc8bd492354a0880714f7a8a8b4ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D0=B2=D0=BE=D1=80=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Fri, 23 Sep 2016 23:55:53 +0300 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ilkka Myller Reviewed-By: Anna Henningsen --- lib/dgram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dgram.js b/lib/dgram.js index c088bffa7ff477..31be3ce881ed22 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -353,7 +353,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.