avoid a few zeroMem (#932)

This commit is contained in:
Jacek Sieka 2023-07-11 12:17:28 +02:00 committed by GitHub
parent 1721f078c7
commit fab1340020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -276,7 +276,7 @@ proc readLp*(s: LPStream, maxSize: int): Future[seq[byte]] {.async, gcsafe, publ
if length == 0:
return
var res = newSeq[byte](length)
var res = newSeqUninitialized[byte](length)
await s.readExactly(addr res[0], res.len)
return res

View File

@ -43,7 +43,7 @@ proc initVBuffer*(data: seq[byte], offset = 0): VBuffer =
proc initVBuffer*(data: openArray[byte], offset = 0): VBuffer =
## Initialize VBuffer with copy of ``data``.
result.buffer = newSeq[byte](len(data))
result.buffer = newSeqUninitialized[byte](len(data))
if len(data) > 0:
copyMem(addr result.buffer[0], unsafeAddr data[0], len(data))
result.offset = offset