avoid a few zeroMem (#932)
This commit is contained in:
parent
1721f078c7
commit
fab1340020
|
@ -276,7 +276,7 @@ proc readLp*(s: LPStream, maxSize: int): Future[seq[byte]] {.async, gcsafe, publ
|
||||||
if length == 0:
|
if length == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
var res = newSeq[byte](length)
|
var res = newSeqUninitialized[byte](length)
|
||||||
await s.readExactly(addr res[0], res.len)
|
await s.readExactly(addr res[0], res.len)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ proc initVBuffer*(data: seq[byte], offset = 0): VBuffer =
|
||||||
|
|
||||||
proc initVBuffer*(data: openArray[byte], offset = 0): VBuffer =
|
proc initVBuffer*(data: openArray[byte], offset = 0): VBuffer =
|
||||||
## Initialize VBuffer with copy of ``data``.
|
## Initialize VBuffer with copy of ``data``.
|
||||||
result.buffer = newSeq[byte](len(data))
|
result.buffer = newSeqUninitialized[byte](len(data))
|
||||||
if len(data) > 0:
|
if len(data) > 0:
|
||||||
copyMem(addr result.buffer[0], unsafeAddr data[0], len(data))
|
copyMem(addr result.buffer[0], unsafeAddr data[0], len(data))
|
||||||
result.offset = offset
|
result.offset = offset
|
||||||
|
|
Loading…
Reference in New Issue