diff options
author | alejandro <alemures@hotmail.com> | 2017-03-07 16:25:58 +0000 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-04-05 18:36:09 -0700 |
commit | 51587b22029a53b32122b5d577defb6a7577ea5f (patch) | |
tree | 4bc121ff193a3979cbab709965b393cbe83dad5a /.github | |
parent | ebeee853e69a96016e59263e60d38d490f6e3490 (diff) | |
download | android-node-v8-51587b22029a53b32122b5d577defb6a7577ea5f.tar.gz android-node-v8-51587b22029a53b32122b5d577defb6a7577ea5f.tar.bz2 android-node-v8-51587b22029a53b32122b5d577defb6a7577ea5f.zip |
buffer: preallocate array with buffer length
Because the final array length is known, it's better to allocate its
final length at initialization time to avoid future reallocations.
Also add an explicit buffer length greater than 0 comparison so
it's more readable, avoids the internal ToBoolean call and follows the
standard Node.js API format (as it can be checked in other similar
structures where 'length > 0' is preferred over 'length')
PR-URL: https://github.com/nodejs/node/pull/11733
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions