(cherry picked from commit 124a584eb2)
This commit is contained in:
Andreas Rumpf
2019-07-08 19:40:42 +02:00
committed by narimiran
parent 092154de02
commit 78b665cc7f

View File

@@ -172,7 +172,12 @@ proc setLen[T](s: var seq[T], newlen: Natural) =
if newlen < s.len:
shrink(s, newLen)
else:
grow(s, newLen, default(T))
let oldLen = s.len
if newLen <= oldLen: return
var xu = cast[ptr NimSeqV2[T]](addr s)
if xu.p == nil or xu.p.cap < newLen:
xu.p = cast[typeof(xu.p)](prepareSeqAdd(oldLen, xu.p, newLen - oldLen, sizeof(T)))
xu.len = newLen
when false:
proc resize[T](s: var NimSeqV2[T]) =