Skip to content

Commit 06a397c

Browse files
committed
Nicer for loop
1 parent bcaa2d5 commit 06a397c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sendtables/propdecoder.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,15 @@ func (propertyDecoder) decodeArray(fProp *FlattenedPropEntry, reader *bit.BitRea
291291
numBits++
292292
}
293293

294-
nElements := int(reader.ReadInt(numBits))
295-
296-
res := make([]PropValue, 0, nElements)
294+
res := make([]PropValue, int(reader.ReadInt(numBits)))
297295

298296
tmp := &PropertyEntry{
299297
entry: &FlattenedPropEntry{prop: fProp.arrayElementProp},
300298
}
301299

302-
for i := 0; i < nElements; i++ {
300+
for i := range res {
303301
propDecoder.decodeProp(tmp, reader)
304-
res = append(res, tmp.value)
302+
res[i] = tmp.value
305303
}
306304

307305
return res

0 commit comments

Comments
 (0)