diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/strs_v2.nim | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/system/strs_v2.nim b/lib/system/strs_v2.nim index 3beb14382..aa644522f 100644 --- a/lib/system/strs_v2.nim +++ b/lib/system/strs_v2.nim @@ -107,8 +107,7 @@ proc mnewString(len: int): NimStringV2 {.compilerproc.} = proc setLengthStrV2(s: var NimStringV2, newLen: int) {.compilerRtl.} = if newLen == 0: - frees(s) - s.p = nil + discard "do not free the buffer here, pattern 's.setLen 0' is common for avoiding allocations" else: if newLen > s.len or isLiteral(s): prepareAdd(s, newLen - s.len) |