This commit is contained in:
Andreas Rumpf 2019-03-15 14:57:40 +01:00
commit 8e5c1436ad

View file

@ -116,6 +116,11 @@ proc newOwnedString(src: NimString; n: int): NimString =
proc copyStringRC1(src: NimString): NimString {.compilerRtl.} = proc copyStringRC1(src: NimString): NimString {.compilerRtl.} =
if src != nil: if src != nil:
if (src.reserved and seqShallowFlag) != 0:
result = src
when declared(incRef):
incRef(usrToCell(result))
else:
when declared(newObjRC1) and not defined(gcRegions): when declared(newObjRC1) and not defined(gcRegions):
var s = src.len var s = src.len
if s < 7: s = 7 if s < 7: s = 7