File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -457,10 +457,6 @@ when not defined(js) and not defined(nimSeqsV2):
457
457
data: UncheckedArray[char ]
458
458
NimString = ptr NimStringDesc
459
459
460
- when notJSnotNims and not defined(nimSeqsV2):
461
- template space(s: PGenericSeq): int {.dirty.} =
462
- s.reserved and not (seqShallowFlag or strlitFlag)
463
-
464
460
when notJSnotNims:
465
461
include "system/hti"
466
462
@@ -1068,6 +1064,10 @@ const
1068
1064
hasThreadSupport = compileOption(" threads" ) and not defined(nimscript)
1069
1065
hasSharedHeap = defined(boehmgc) or defined(gogc) # don't share heaps; every thread has its own
1070
1066
1067
+ when notJSnotNims and not defined(nimSeqsV2):
1068
+ template space(s: PGenericSeq): int =
1069
+ s.reserved and not (seqShallowFlag or strlitFlag)
1070
+
1071
1071
when hasThreadSupport and defined(tcc) and not compileOption(" tlsEmulation" ):
1072
1072
# tcc doesn't support TLS
1073
1073
{.error: " `--tlsEmulation:on` must be used when using threads with tcc backend" .}
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ func capacity*[T](self: seq[T]): int {.inline.} =
150
150
assert lst.capacity == 42
151
151
152
152
let sek = cast[ptr NimSeqV2[T]](unsafeAddr self)
153
- result = if sek.p != nil: ( sek.p.cap and not strlitFlag) else: 0
153
+ result = if sek.p != nil: sek.p.cap and not strlitFlag else: 0
154
154
155
155
156
156
{.pop.} # See https://github.com/nim-lang/Nim/issues/21401
Original file line number Diff line number Diff line change @@ -211,4 +211,4 @@ func capacity*(self: string): int {.inline.} =
211
211
assert str.capacity == 42
212
212
213
213
let str = cast [ptr NimStringV2](unsafeAddr self)
214
- result = if str.p != nil : str.p.cap else : 0
214
+ result = if str.p != nil : str.p.cap and not strlitFlag else : 0
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ func capacity*(self: string): int {.inline.} =
350
350
assert str.capacity == 42
351
351
352
352
let str = cast[NimString](self)
353
- result = if str != nil: str.reserved else: 0
353
+ result = if str != nil: str.space else: 0
354
354
355
355
func capacity*[T](self: seq [T]): int {.inline.} =
356
356
## Returns the current capacity of the seq .
@@ -361,4 +361,4 @@ func capacity*[T](self: seq[T]): int {.inline.} =
361
361
assert lst.capacity == 42
362
362
363
363
let sek = cast[PGenericSeq](self)
364
- result = if sek != nil: ( sek.reserved and not strlitFlag) else: 0
364
+ result = if sek != nil: sek.space else: 0
You can’t perform that action at this time.
0 commit comments