diff options
author | Amjad Ben Hedhili <amjadhedhili@outlook.com> | 2023-09-18 21:57:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 22:57:30 +0200 |
commit | b542be1e7de067573370a3159b0812396309ef8b (patch) | |
tree | 2b04290a16ca92b85ef53e5c5f2e49589b38e3d9 /lib/system/sysstr.nim | |
parent | 2c5b94bbfd8a050ce08072222511cbb9eb20f771 (diff) | |
download | Nim-b542be1e7de067573370a3159b0812396309ef8b.tar.gz |
Fix `capacity` for const and shallow [backport] (#22705)
Diffstat (limited to 'lib/system/sysstr.nim')
-rw-r--r-- | lib/system/sysstr.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index 54d0f2b2f..e4d6479ec 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -343,7 +343,7 @@ func capacity*(self: string): int {.inline.} = assert str.capacity == 42 let str = cast[NimString](self) - result = if str != nil: str.reserved else: 0 + result = if str != nil: str.space else: 0 func capacity*[T](self: seq[T]): int {.inline.} = ## Returns the current capacity of the seq. @@ -354,4 +354,4 @@ func capacity*[T](self: seq[T]): int {.inline.} = assert lst.capacity == 42 let sek = cast[PGenericSeq](self) - result = if sek != nil: (sek.reserved and not strlitFlag) else: 0 + result = if sek != nil: sek.space else: 0 |