system.nim: minor code cleanup

This commit is contained in:
Andreas Rumpf
2018-04-28 07:57:44 +02:00
parent f697596faf
commit 65c08212db

View File

@@ -101,9 +101,6 @@ proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} =
if str == nil: NimString(nil)
else: toNimStr(str, str.len)
template wasMoved(x: NimString): bool = false
# (x.reserved and seqShallowFlag) != 0
proc copyString(src: NimString): NimString {.compilerRtl.} =
if src != nil:
if (src.reserved and seqShallowFlag) != 0:
@@ -209,7 +206,7 @@ proc addChar(s: NimString, c: char): NimString =
proc resizeString(dest: NimString, addlen: int): NimString {.compilerRtl.} =
if dest == nil:
result = rawNewStringNoInit(addlen)
elif dest.len + addlen <= dest.space and not wasMoved(dest):
elif dest.len + addlen <= dest.space:
result = dest
else: # slow path:
var sp = max(resize(dest.space), dest.len + addlen)