diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-09-22 10:15:30 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-09-22 10:15:30 +0200 |
commit | fe99495a9bb4d1cc7127d98d5510b96a699225b1 (patch) | |
tree | c9d83e441ae94032c2c3a5580cd7343c590857d6 /lib | |
parent | c383e4d35e4993f4cf094f984ae6acbd3f892a8b (diff) | |
download | Nim-fe99495a9bb4d1cc7127d98d5510b96a699225b1.tar.gz |
new string behaviour now available under nimShallowStrings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/sysstr.nim | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index 8270bc525..a8d91b39c 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -95,10 +95,7 @@ proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} = if str == nil: NimString(nil) else: toNimStr(str, str.len) -when defined(nimImmutableStrings): - template wasMoved(x: NimString): bool = (x.reserved and seqShallowFlag) != 0 -else: - template wasMoved(x: NimString): bool = false +template wasMoved(x: NimString): bool = (x.reserved and seqShallowFlag) != 0 proc copyString(src: NimString): NimString {.compilerRtl.} = if src != nil: @@ -109,7 +106,7 @@ proc copyString(src: NimString): NimString {.compilerRtl.} = result.len = src.len copyMem(addr(result.data), addr(src.data), src.len + 1) sysAssert((seqShallowFlag and result.reserved) == 0, "copyString") - when defined(nimImmutableStrings): + when defined(nimShallowStrings): if (src.reserved and strlitFlag) != 0: result.reserved = (result.reserved and not strlitFlag) or seqShallowFlag @@ -132,7 +129,7 @@ proc copyStringRC1(src: NimString): NimString {.compilerRtl.} = result.len = src.len copyMem(addr(result.data), addr(src.data), src.len + 1) sysAssert((seqShallowFlag and result.reserved) == 0, "copyStringRC1") - when defined(nimImmutableStrings): + when defined(nimShallowStrings): if (src.reserved and strlitFlag) != 0: result.reserved = (result.reserved and not strlitFlag) or seqShallowFlag |