diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-10-03 16:46:09 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-10-04 09:48:45 +0200 |
commit | 60d64d1aeffe6020eb591eca4be7ae672e45edc0 (patch) | |
tree | d66226b1c2ba3328b3d3ba91581c50585dee0480 /lib/pure/streams.nim | |
parent | 68ce808db131081a565e9fb2dfca3d66197d8175 (diff) | |
download | Nim-60d64d1aeffe6020eb591eca4be7ae672e45edc0.tar.gz |
use system.move instead of system.shallowCopy if the GC mode requires it
Diffstat (limited to 'lib/pure/streams.nim')
-rw-r--r-- | lib/pure/streams.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 0435e1f36..3850d10e2 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -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 |