File tree 4 files changed +8
-8
lines changed
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
@@ -1048,6 +1044,10 @@ const
1048
1044
hasThreadSupport = compileOption (" threads" ) and not defined (nimscript)
1049
1045
hasSharedHeap = defined (boehmgc) or defined (gogc) # don't share heaps; every thread has its own
1050
1046
1047
+ when notJSnotNims and not defined (nimSeqsV2):
1048
+ template space (s: PGenericSeq ): int =
1049
+ s.reserved and not (seqShallowFlag or strlitFlag)
1050
+
1051
1051
when hasThreadSupport and defined (tcc) and not compileOption (" tlsEmulation" ):
1052
1052
# tcc doesn't support TLS
1053
1053
{.error : " `--tlsEmulation:on` must be used when using threads with tcc backend" .}
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ func capacity*[T](self: seq[T]): int {.inline.} =
193
193
assert lst.capacity == 42
194
194
195
195
let sek = cast [ptr NimSeqV2 [T]](unsafeAddr self)
196
- result = if sek.p != nil : ( sek.p.cap and not strlitFlag) else : 0
196
+ result = if sek.p != nil : sek.p.cap and not strlitFlag else : 0
197
197
198
198
199
199
{.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 @@ -343,7 +343,7 @@ func capacity*(self: string): int {.inline.} =
343
343
assert str.capacity == 42
344
344
345
345
let str = cast [NimString ](self)
346
- result = if str != nil : str.reserved else : 0
346
+ result = if str != nil : str.space else : 0
347
347
348
348
func capacity * [T](self: seq [T]): int {.inline .} =
349
349
# # Returns the current capacity of the seq.
@@ -354,4 +354,4 @@ func capacity*[T](self: seq[T]): int {.inline.} =
354
354
assert lst.capacity == 42
355
355
356
356
let sek = cast [PGenericSeq ](self)
357
- result = if sek != nil : ( sek.reserved and not strlitFlag) else : 0
357
+ result = if sek != nil : sek.space else : 0
You can’t perform that action at this time.
0 commit comments