use system.move instead of system.shallowCopy if the GC mode requires it

This commit is contained in:
Andreas Rumpf 2019-10-03 16:46:09 +02:00
commit 60d64d1aef
14 changed files with 61 additions and 36 deletions

View file

@ -311,7 +311,7 @@ proc write*[T](s: Stream, x: T) =
##
## .. code-block:: Nim
##
## s.writeData(s, addr(x), sizeof(x))
## s.writeData(s, unsafeAddr(x), sizeof(x))
runnableExamples:
var strm = newStringStream("")
strm.write("abcde")
@ -319,9 +319,7 @@ proc write*[T](s: Stream, x: T) =
doAssert strm.readAll() == "abcde"
strm.close()
var y: T
shallowCopy(y, x)
writeData(s, addr(y), sizeof(y))
writeData(s, unsafeAddr(x), sizeof(x))
proc write*(s: Stream, x: string) =
## Writes the string `x` to the the stream `s`. No length field or