Skip to content

Commit ba806ae

Browse files
committed
revert listLen caching
1 parent 885c7a3 commit ba806ae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/buffer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,12 @@ Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
608608
Buffer.concat = function concat(list, length) {
609609
validateArray(list, 'list');
610610

611-
const listLen = list.length;
612-
if (listLen === 0)
611+
if (list.length === 0)
613612
return new FastBuffer();
614613

615614
if (length === undefined) {
616615
length = 0;
617-
for (let i = 0; i < listLen; i++) {
616+
for (let i = 0; i < list.length; i++) {
618617
const buf = list[i];
619618
if (!isUint8Array(buf)) {
620619
// TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.
@@ -627,7 +626,7 @@ Buffer.concat = function concat(list, length) {
627626

628627
const buffer = allocate(length);
629628
let pos = 0;
630-
for (let i = 0; i < listLen; i++) {
629+
for (let i = 0; i < list.length; i++) {
631630
const buf = list[i];
632631
TypedArrayPrototypeSet(buffer, buf, pos);
633632
pos += buf.length;
@@ -642,7 +641,7 @@ Buffer.concat = function concat(list, length) {
642641
validateOffset(length, 'length');
643642
const buffer = allocate(length);
644643
let pos = 0;
645-
for (let i = 0; i < listLen; i++) {
644+
for (let i = 0; i < list.length; i++) {
646645
const buf = list[i];
647646
if (!isUint8Array(buf)) {
648647
// TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.

0 commit comments

Comments
 (0)